-
Notifications
You must be signed in to change notification settings - Fork 568
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fire close
on failed WebSocket connection
#3566
Conversation
Not sure why the |
Some details on what is actually the issue. The issue revolves around why the event is not being fired on unsuccessful connection. It is because the function that does the event firing is linked to an object that does not exist before a connection is actually successfully established. undici/lib/web/websocket/websocket.js Lines 481 to 490 in 6818acc
|
055dd5b
to
6818acc
Compare
Thoughts? Reviews? Any change requested? The current implementation of WebSocket is not firing the undici/test/websocket/issue-3546.js Line 8 in 990df2c
|
I do not like this patch but I haven't had time to look into a real fix.
|
AKA why not It is because it fails autobahn test suite, see https://github.com/eXhumer/undici/actions/runs/10837039351/job/30072121866 & https://github.com/eXhumer/undici/actions/runs/10837160880/job/30072507418
Correct, but in a case where connection is closed without failing, it is instead handled by |
Currently, And undici/lib/web/websocket/connection.js Lines 197 to 199 in 618005e
Also, should the close code be 1002 if there is a connection establish error? Should it not be 1006 instead as the connection is not considered clean and a close frame is never received? |
I atleast reopened the issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This reverts commit 290e0e1.
This relates to...
See #3546, #3548 & #3565
CC: @Uzlopak @KhafraDev
Rationale
#3565 attempted to fix #3546, however the test for #3546 made in #3548 was modified in #3565 and skipped the
close
event check, which ultimately ended up with not actually fixing the original issue. This PR will check theclose
event correctly and correctly fixes the original issue.Additionally, this commit has been already tested to make sure it passes the autobahn testsuite
Changes
close
event if there is no successful connection to server.close
event correctly firing.Features
N/A
Bug Fixes
close
event on unsuccessful connectionBreaking Changes and Deprecations
N/A
Status