-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
[WebSocket] Add CloseEvent
#50275
Comments
There has been no activity on this feature request for 5 months. To help maintain relevant open issues, please add the
never-stale
|
|
@nodejs/undici |
This is a actually easy to add. |
once undici is updated it will be |
Didnt I merge your PR @KhafraDev So it should be already part of the next release ;) |
Undici has to release a new version. Then nodejs will update the dependency. And then you have to rebase your PR. |
This PR adds `CloseEvent` as a global, which can be disabled via the --no-experimental-websocket flag. ```js const ws = new WebSocket('...') ws.addEventListener('close', (event) => { assert(event instanceof CloseEvent) }) ``` Fixes: nodejs#50275
This PR adds `CloseEvent` as a global, which can be disabled via the --no-experimental-websocket flag. ```js const ws = new WebSocket('...') ws.addEventListener('close', (event) => { assert(event instanceof CloseEvent) }) ``` Fixes: nodejs#50275
This PR adds `CloseEvent` as a global, which can be disabled via the --no-experimental-websocket flag. ```js const ws = new WebSocket('...') ws.addEventListener('close', (event) => { assert(event instanceof CloseEvent) }) ``` Fixes: nodejs#50275
This PR adds `CloseEvent` as a global, which can be disabled via the --no-experimental-websocket flag. ```js const ws = new WebSocket('...') ws.addEventListener('close', (event) => { assert(event instanceof CloseEvent) }) ``` Fixes: #50275 PR-URL: #53355 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This PR adds `CloseEvent` as a global, which can be disabled via the --no-experimental-websocket flag. ```js const ws = new WebSocket('...') ws.addEventListener('close', (event) => { assert(event instanceof CloseEvent) }) ``` Fixes: nodejs#50275 PR-URL: nodejs#53355 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This PR adds `CloseEvent` as a global, which can be disabled via the --no-experimental-websocket flag. ```js const ws = new WebSocket('...') ws.addEventListener('close', (event) => { assert(event instanceof CloseEvent) }) ``` Fixes: nodejs#50275 PR-URL: nodejs#53355 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Paolo Insogna <paolo@cowtech.it> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
What is the problem this feature will solve?
In Node.js v21 with
--experimental-websocket
, theCloseEvent
class isn't defined. This event is sent to clients using WebSockets when the connection is closed.What is the feature you are proposing to solve the problem?
Add the
CloseEvent
class in the global scope (behind--experimental-websocket
flags). I found it in undici but it isn't exported. Or add theCloseEvent
class next toMessageEvent
(directly in Node.js).What alternatives have you considered?
No response
Related issues
CloseEvent
#46880ErrorEvent
andCloseEvent
on global scope undici#2084The text was updated successfully, but these errors were encountered: