-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
No way to detect half-closed websockets #2225
Comments
No, there isn't. You can use the websocket._receiver.on('conclude', handler); You shouldn't close the connection when this event is emitted because the closing handshake is not yet complete. The connection should be closed only after the close frame has been sent and received. |
Thank you for your reply. Would it be correct to use the 'conclude' event to set a timer and if, say, 10 seconds later the connection is still not closed, terminate() it? |
The library forcibly closes the connection if it is not closed properly 30 seconds after calling |
I'm closing this as answered. |
Is there an existing issue for this?
Description
Is there any way to detect when the remote websocket client has half-closed the connection?
I would like to drop the connection upon this happening but I don't seem to find a way to detect this.
Thank you.
ws version
1.0.34
Node.js Version
v18.13.0
System
Linux Debian 12
Expected result
Some kind of on('end') handler.
Actual result
No on('end') (or similar) handler to be found in the docs or issues.
Attachments
No response
The text was updated successfully, but these errors were encountered: