Answer the question
In order to leave comments, you need to log in
Socket.disconnect() closes current connection or all?
Perhaps a stupid question.
The phrase in the documentation baffled me.
Disconnects this client. If value of close is true, closes the underlying connection. Otherwise, it just disconnects the namespace.
Explain what this code closes
io.on('connection', (socket) => {
setTimeout(() => socket.disconnect(true), 5000);
});
io.on('connection', (socket) => {
setTimeout(() => socket.disconnect(), 5000);
});
Answer the question
In order to leave comments, you need to log in
true => disconnects the client completely
false => disconnects from the current namespace
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question