Skip to content
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(ext/websocket): don't throw exception when sending to closed socket #26932

Merged
merged 3 commits into from
Nov 21, 2024

Conversation

bellinitte
Copy link
Contributor

@bellinitte bellinitte commented Nov 19, 2024

The WebSocket specification for the send function says:

The browser will throw an exception if you call send() when the connection is in the CONNECTING state. If you call send() when the connection is in the CLOSING or CLOSED states, the browser will silently discard the data.

and:

Exceptions

InvalidStateError DOMException

Thrown if WebSocket.readyState is CONNECTING.

This pull request fixes the current behavior to match the specification. Also, I believe it fixes #17586.

@CLAassistant
Copy link

CLAassistant commented Nov 19, 2024

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@littledivy littledivy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bartlomieju bartlomieju merged commit 8f7787f into denoland:main Nov 21, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uncaught InvalidStateError: readyState not OPEN
4 participants