fix(socket.io): improve close() function#5344
Closed
fantua wants to merge 2 commits intosocketio:mainfrom
Closed
Conversation
fantua
commented
Apr 30, 2025
| }, | ||
| "packages/engine.io": { | ||
| "version": "6.6.3", | ||
| "version": "6.6.4", |
Contributor
Author
|
@darrachequesne could you please take a look? Thanks |
|
I think it's good moment to deprecate the error argument here: socket.io/packages/socket.io/lib/index.ts Line 807 in 91e1c8b |
darrachequesne
pushed a commit
that referenced
this pull request
Dec 22, 2025
Before this change, `await io.close();` would resolve before the HTTP server was properly shut down. Related: #4971
Member
|
Merged as bb0b480, and included in @piotr-cz we will do this in the next major release Related: #4546 |
|
How about deprecating the callback (docblock, docs) in minor/ patch version and removing in major version? |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The kind of change this PR does introduce
Current behavior
After #4971 the usage of the
close()function has become confusing and sometimes misleading.Since
close()now returns a Promise, I would expect thehttpServerto close when the promise is resolved. However, this is not the case.Also, in order to catch all possible errors, I need to use a mixed style of async/await and callbacks:
New behavior