i gave it another shot and still don't get it.
when I connect the first time i have:
- browser A which serves as a source of "connect" command
- AsyncJsonWebsocketConsumer which handles group_add, accepting incoming socket and setting the "connection A"
when I have a call from the other browser:
- browser B which sends another "connect"
- another consumer. how does it know about "connection A" to close it? it handles it's own connection B
and all the time browser is the initiator of commands. I still don't understand what call i should make when I return a newly create JWT to close connection A.
i still don't get it. I saw
this code and
this in the sources, but how shou;d a layer know which of thousands websockets to close? I tried to send
async_to_sync(channel_layer.group_discard)("notifications.36", "specific.WrFJFDXq!rIkVZzwQtBCC")
async_to_sync(channel_layer.group_send)("notifications.36", {"type": "websocket_close"})
and neither of these calls succeeded - browser still receives messages sent from notification (the last one succeeds actually, but it closes room for ALL participants, not to specific one. and they promptly reconnect). And I'm not surprised, when the call is made from specific ws consumer, the channel layers knows what to close (as far as I understand). and when it's done simply from the shell...