Hello, I am writing chat on django-channels . Faced the problem that after rebooting the server, the old channels are not removed from the group, but new ones are created. Backend: 'asgi_redis.RedisChannelLayer' . How to "kill" all the channels when rebooting, or the old channel, for a user when connecting?

Connect Consumer:

def on_connect(message): Group('chat').add(message.reply_channel) 

Disconnect Consumer:

 def on_disconnect(message): Group('chat').discard(message.reply_channel) 

    1 answer 1

    And if add not to do, and try to send to the same channel? It is more accurate to try to send, if it does not work out - then create a channel. This is just an idea, the channels themselves are just beginning to learn.