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

Allow closing WSMessageHandler stream with a close code #137

Open
liautaud opened this issue Dec 13, 2024 · 0 comments
Open

Allow closing WSMessageHandler stream with a close code #137

liautaud opened this issue Dec 13, 2024 · 0 comments

Comments

@liautaud
Copy link

liautaud commented Dec 13, 2024

Hi! First of all thanks for the library, it's been really great to use.

Would you be open to adding a way for a WSMessageHandler to close the server stream with .close(code: closeCode) frames in some way or another? The typical use case is closing a WebSocket connection after some unrecoverable error while wanting the client-side to know what the error actually is–in JavaScript, for instance, you can read event.code on a WebSocket "close" event.

I could already implement this behavior by falling back to the more cumbersome WSHandler level, but it seems like a frequent enough use case that it would make sense at the WSMessageHandler level too.

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

No branches or pull requests

1 participant