Answer the question
In order to leave comments, you need to log in
Why does the disconnect event fail in socket.io?
There is quite a common structure on node.js + socket.io:
io.on('connection', function (socket) {
socket.on('add user', function (hash, interlocutor_id) {
});
socket.on('private message', function (from, msg) {
});
socket.on('disconnect', function () {
});
});
var socket = io.connect(':8080', {'sync disconnect on unload': true});
Answer the question
In order to leave comments, you need to log in
At least you don’t have to do it the way you do: https://toster.ru/answer?answer_id=477715
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question