Blade
Blade

Reputation: 190

How to remove all connections from a group in channel layer | Django Channels

I want to use the channels groups as a lobby system for a game and when the game ends, remove everyone from the lobby but I'm unsure how to 1) iterate through users in the group, 2) remove all users or delete the group in total.

Upvotes: 0

Views: 1489

Answers (1)

Matthaus Woolard
Matthaus Woolard

Reputation: 2408

in channels you can't list the consumers that have subscribed to a group..

Instead I suggest sending a message over the channel group (close) that you handle in the consumers.

Channels/Reddis/RabbitMQ is set up to close groups when no active consumers are subscribed to them so dont worry about leaking groups.

Upvotes: 2

Related Questions