socket.io-client
socket.io-client copied to clipboard
Calling `manager.disconnect()` before a socket is created fails
If you create a manager using the Manager api directly, and then call manager.disconnect() before any sockets are created with manager.socket():
const manager = new Manager('/', { ... })
manager.disconnect()
It will show a warning in DevTools and no future calls to manager.connect() will seemingly get it to start working again. But it also doesn't seem to know it's disconnected? Hard to tell, but it breaks.
Ideally using disconnect/connect should be allowed in any state without breakage. I'm using the manager directly because I'd like to control connection status across all sockets when the tab loses visibility.
Maybe I'm not understanding something?