Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: fix
socket.disconnect().connect()
usage
Previously, calling `socket.disconnect().connect()` could, if the connection was upgraded to WebSocket, result in "disconnect" being emitted twice, and an engine being leaked. Here's what happened: > socket.disconnect() - calls `socket.destroy()` so the socket doesn't listen to the manager events anymore - then calls `manager._close()` which closes the underlying engine but not the manager itself (it waits for the "close" event of the engine) > socket.connect() - calls `socket.subEvents()` so the socket does listen to the manager events - calls `manager.open()` which creates a new engine And then the first engine emits a "close" event, which is forwarded to the socket, hence the second "disconnect" event. Related: #1014
- Loading branch information