I am using django-channels>=2.0.0 and I want to find how many users in "room1". I don't know how to find total connections.
Asked
Active
Viewed 1,464 times
1 Answers
0
Using the InMemoryChannelLayer
, inside your consumer
, you can check how many connections have been added to your channel layer with :
len(self.channel_layer.groups.get('room1', {}).items())

drec4s
- 7,946
- 8
- 33
- 54
-
I got this error: 'RedisChannelLayer' object has no attribute 'groups' – John Jun 18 '20 at 09:16
-
Right, this is was tested using the `InMemoryChannelLayer`. – drec4s Jun 18 '20 at 10:22