-
Notifications
You must be signed in to change notification settings - Fork 539
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 fail for WebSocket #3548
Conversation
* see #3546 Signed-off-by: eXhumer <exhumer@exhumer.cc>
LGTM |
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.
please add a test
Some of the autobahn test keep failing locally due to tests timing out. If there is any actual issue unrelated to timeout, please let me know. |
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.
I think the test can test a little bit more
* updated with requested changes Signed-off-by: eXhumer <exhumer@exhumer.cc>
e7beb86
to
5e2cd77
Compare
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
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.
a bunch of autobahn tests are failing
We can remove line 525, where we set the connection status, because we call #onSocketClose. And the change in #onSocketClose with optional chaining brakes the autobahn. Because it changes the error code to 1006 instead of 1005. Probably need to make #onSocketClose accept a parameter. If we pass a symbol kFail than we handle the onFail case and code stays at 1005. Or maybe use the wasClean variable? |
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.
.
The issue is that onSocketClose is not appropriate to call here. You need to handle setting the state to CLOSED and emitting a close event in a separate function that both onFail and onSocketClose can use. |
Sorry for not getting to back to this earlier. After KhafkaDev said there were autobahn tests failing, I wanted to properly setup the tests locally to make sure they were working as expected. Although the test seem to be running fine on CI, it seems to fail test cases between 12.4.3 and 12.4.18 locally, while passing on CI. Does anyone have any insight on why this may be the case? And in some cases, re-running the same test locally seem to produce different fails. I have tried to do the autobahn test on two different machines (macOS 15.1 & Windows 11), both seem to fail these 16 tests locally.
I was unable to do any reliable testing locally as a result. |
This relates to...
Fixes #3546
Rationale
close
event is never fired after a WebSocket connection is failed to establish.Changes
WebSocket.#onSocketClose
when trying to accessclosingInfo
.WebSocket.#parser
isundefined
when connection fails to establish.WebSocket.#onSocketClose
after firingerror
event, which in turn fires theclose
event.Features
N/A
Bug Fixes
close
event not firing on failed connection.Breaking Changes and Deprecations
N/A
Status