-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: discard acknowledgements upon disconnection
Previously, getting disconnected while waiting for an acknowledgement would create a memory leak, as the acknowledgement was never received and the handler would stay in memory forever. This commit fixes the issue: - handlers that do accept an error as first argument, such as: * `socket.emit("test", (err, value) => { ... })` with `ackTimeout` option * `socket.timeout(5000).emit("test", (err, value) => { ... })` * `const value = await socket.emitWithAck("test")` will now properly resolve with an error and get discarded. - handlers that don't like `socket.emit("test", (value) => { ... });` will simply be discarded upon disconnection Note: the structure of the 'acks' attribute has been left untouched, in order to prevent any breaking change. Related: - #1546 - socketio/socket.io#4964
- Loading branch information
1 parent
8cfea8c
commit 34cbfbb
Showing
2 changed files
with
198 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters