-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
indefinite behavior of nodejs/events.once() on WebSocket #1795
Comments
I think nodejs/node#34015 will be backported to Node.js 12 so the issue should only be temporary. |
lpinca
added a commit
to lpinca/node
that referenced
this issue
Oct 26, 2020
Assume that the `emitter` argument of `EventEmitter.once()` is an `EventEmitter` if `emitter.on` is a function. Refs: nodejs@4b3654e923e7c3c2 Refs: websockets/ws#1795
3 tasks
MylesBorins
pushed a commit
to nodejs/node
that referenced
this issue
Nov 16, 2020
Assume that the `emitter` argument of `EventEmitter.once()` is an `EventEmitter` if `emitter.on` is a function. Refs: 4b3654e923e7c3c2 Refs: websockets/ws#1795 PR-URL: #35818 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
I'm closing this as the issue should be fixed in Node.js v12.20.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hello guys.
the function
once
of nodejs v12 LTS makes different behaviors between EventEmitter or EventTarget. REFonce
makes judgement about whether an emitter is an EventEmitter or an EventTarget according to whetheremitter.addEventListener
is a function. REFsince WebSocket implements
addEventListener
inws/lib/websocket.js
Line 22 in 535c556
once
will misjudge the emitter to be an EventTarget and it will not listen toerror
event. thus, users cannot do:this will be waiting forever if it fails to connect.
since it's said in docs that
, this will mislead users.
but this problem does not exist with nodejs v14, because nodejs v14 makes that judgement via whether
emitter.on
is a function. REFi don't think it's a bug, but it'd be better if this problem should be warning in docs
The text was updated successfully, but these errors were encountered: