fix: fire close on fail for WebSocket#3548
fix: fire close on fail for WebSocket#3548eXhumer wants to merge 3 commits intonodejs:mainfrom eXhumer:fire-close-on-fail-ws
Conversation
* see #3546 Signed-off-by: eXhumer <exhumer@exhumer.cc>
|
LGTM |
|
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. |
Uzlopak
left a comment
There was a problem hiding this comment.
I think the test can test a little bit more
* updated with requested changes Signed-off-by: eXhumer <exhumer@exhumer.cc>
KhafraDev
left a comment
There was a problem hiding this comment.
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? |
|
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
closeevent is never fired after a WebSocket connection is failed to establish.Changes
WebSocket.#onSocketClosewhen trying to accessclosingInfo.WebSocket.#parserisundefinedwhen connection fails to establish.WebSocket.#onSocketCloseafter firingerrorevent, which in turn fires thecloseevent.Features
N/A
Bug Fixes
closeevent not firing on failed connection.Breaking Changes and Deprecations
N/A
Status