thank you for the help. I need to try it out. i think it's more down the "tell-clients-to-tell-me-to-close" route which i wanted to escape.
however, i still don't understand how i can get ALL connections of a user knowing only his token. i mean, when i have an event in the system, i want to notify a user about - i KNOW which group I must send it to, so it's up to client to consume this message. I did all I should - sent it. And now it's like vice versa - I must learn which group to send message to, knowing only a recipient ID. I imagined it as like in django admin view there could be a page at UserAdmin: "close all websockets for this user" - in such case we have a manage.py command, or any random view which knows nothing about clients-communicatiors. only about a user, whose connections must be closed. maybe, you're right, and i'm thinking about it the wrong way.... On Monday, 6 April 2020 15:28:44 UTC+4, Roger Gammans wrote: > > I think you are looking at it from the wrong direction. > > Think about it in terms of consumers/connections, not in terms of > users,and in terms of send receiving events. > > When in your consumers connect method, you subscribe (eg > self.channel_layer.group_add() ) to add appropriate group to send user > global messages. One of those messages is close. Then you just need to send > the close message, and make sure you have code to close the connection at > each subscriber. The group doesn't matter you had use any which doesn't > conflict, you might even be able to use one of your exisiting groups. > Although are they the Redis names? I would avoid delving under the hood > with channel_layers and poking redis directly - unless your creating you > own keys. > > > -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cb1b8bbc-dc9c-4cdc-a45c-9c30ed871cd8%40googlegroups.com.