You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The docs for the disconnect event state:
In all cases but the first (disconnection by the server), the client will wait for a small random delay and then reconnect.
In what I've experienced + what I can see from reading the socket.io-client source code, this is not true. Disconnection by the client does not cause a reconnect. Calling socket.disconnect() invokes destroy() which has this comment in the source:
/** * Called upon forced client/server side disconnections, * this method ensures the manager stops tracking us and * that reconnections don't get triggered for this. * * @private */
import{io}from"socket.io-client";constsocket=io("ws://localhost:3000/",{});socket.on("connect",()=>{console.log(`connect ${socket.id}`);socket.disconnect();// this does not cause a reconnect});socket.on("disconnect",()=>{console.log("disconnect");});
Expected behavior
The docs should state that this case does not cause a reconnect
The text was updated successfully, but these errors were encountered:
Describe the bug
The docs for the
disconnect
event state:In what I've experienced + what I can see from reading the
socket.io-client
source code, this is not true. Disconnection by the client does not cause a reconnect. Callingsocket.disconnect()
invokesdestroy()
which has this comment in the source:To Reproduce
Please fill the following code example:
Socket.IO server version:
3
Server
Socket.IO client version:
3
Client
Expected behavior
The docs should state that this case does not cause a reconnect
The text was updated successfully, but these errors were encountered: