Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 django-channels>=2.0.0 并且我想查找“room1”中有多少用户。我不知道如何找到总连接数。
使用InMemoryChannelLayer, 在你的内部consumer,你可以检查有多少连接被添加到你的通道层:
InMemoryChannelLayer
consumer
len(self.channel_layer.groups.get('room1', {}).items())