Socket.io client disconnection issues on NodeJS

Viewed 14

I have an issue with Socket.io: everytime I close and reopen or refresh the page on the JS Client, for some reason the "old socket.io sockets" are not disconnected/destroyed, I still see them receiving messages from a fake sender on the NodeJS server.

So my debugging console is filled with ghost socket.io sockets receiving a message and I don't know how to destroy them, I thought they would close automatically once the browser tab would have been closed.

How do I force a socket.io socket to disconnect?

I have tried socket.removeAllListeners(), socket.disconnect(), and other roads. I guess I'm doing something really stupid but I don't get what

For simplicity I have just created a merged file with the poc: https://gist.github.com/Fabryz/c7b2af02682f7d97474eec4e0dc75645

Thanks in advance

0 Answers
Related