fix(websocket): queue close events after CONNECTING close#5088
Closed
tejasp2022 wants to merge 2 commits intonodejs:mainfrom
Closed
fix(websocket): queue close events after CONNECTING close#5088tejasp2022 wants to merge 2 commits intonodejs:mainfrom
tejasp2022 wants to merge 2 commits intonodejs:mainfrom
Conversation
tejasp2022
commented
Apr 22, 2026
Author
tejasp2022
left a comment
There was a problem hiding this comment.
fix(websocket): queue close events after CONNECTING close
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.
Summary
WebSocket.close()while the socket is stillCONNECTINGWebSocketsoerrorandclosefire afterclose()returnsWebSocketStreamon the old synchronous path so its pre-open abort behavior stays unchangedFixes #4741
Test plan
node --test test/websocket/issue-4741.js test/websocket/issue-3546.js test/websocket/issue-4273.js test/websocket/issue-3697-2399493917.js test/websocket/stream/abort-before-open.jsnpm run test:websocketon Node22.19.0Notes
npm run test:websocketstill reports failures intest/websocket/opening-handshake.js,test/websocket/issue-4989.js, andtest/websocket/diagnostics-channel-handshake-response-h2.js.mainclone under Node22.19.0, so they do not appear to be introduced by this patch.