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

Reconsider async send() #1027

Open
sonnyp opened this issue Dec 21, 2024 · 1 comment
Open

Reconsider async send() #1027

sonnyp opened this issue Dec 21, 2024 · 1 comment

Comments

@sonnyp
Copy link
Member

sonnyp commented Dec 21, 2024

Currently, the send method is async and resolves when the message was sent or rejects if the message couldn't be sent.

Except when using WebSocket with the browser API because it doesn't expose a way to know the message was sent, they are simply queued.

Instead we could make send queue messages. It could also be used in conjunction with stream management.

Node.js and other JavaScript runtimes now implement globalThis.WebSocket and removing ws dependency would be nice to have as well.

Reconsider also sendMany

@sonnyp
Copy link
Member Author

sonnyp commented Dec 21, 2024

I just realized this is a thing now https://developer.mozilla.org/en-US/docs/Web/API/WebSocketStream

write returns a promise so we could adopt that and keep send as is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant