Reputation: 227
At some point of tine a want to close connection by channel name or kick an user? I can't use self.close as I'm not on that user at that point when I want to kick him. P.S. group_discard does not close a connection.
Upvotes: 0
Views: 284
Reputation: 6296
You can send an event to websocket.diconnect just like the other consumer methods:
self.channel_layer.send(
<channel_name>,
{
'type': 'websocket.disconnect',
'code': <code>,
}
)
Upvotes: 2