It seems like I cannot get the disconnect function in the consumer to get called at all.
class ChatConsumer(WebsocketConsumer):
def connect(self):
self.accept()
def disconnect(self):
print('disconnected')
Using self.close from the consumer, or closing the javascript websocket doesn't trigger the print at all, though it does write in the log that the websocket disconnected.
[2018/02/06 09:50:32] WebSocket HANDSHAKING /sessions/ [127.0.0.1:7854]
[2018/02/06 09:50:32] WebSocket CONNECT /sessions/ [127.0.0.1:7854]
[2018/02/06 09:50:39] WebSocket DISCONNECT /sessions/ [127.0.0.1:7854]
Am I using it incorrectly?