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
[Feature] Reason for websocket.close #991
Comments
Created basic implementation in #992 |
https://asgi.readthedocs.io/en/latest/specs/www.html#close-send-event This is not in the ASGI protocol, so it cannot be achieved. |
Thanks @abersheeran yup seems correct to me too. "code" is part of the ASGI spec, but "reason" isn't. If the ASGI spec evolves there at some point, then we could consider it. |
"reason" has been added to the ASGI spec. Will this library add it now as well? |
The code from #992 should still be able to be used … Well, up for grabs |
Should we wait it to be release on the ASGI website? In any case, PR is more than welcome. Thanks @Chaostheorie :) |
The |
When I wrote my comment, it was not :) They just fixed the docs (I asked them the reason 😅). |
I've recently started actively developing with websockets in starlette. When closing a websocket you can provide a code e.g. 1000, 1008 … to tell the client the basic reason. But the websocket protocol allows the developer to also give UTF-8-encoded data as a complementary description/ reason. This would be useful in multiple cases such as mentioning the specific violitioan for code 1008 (POLICY VIOLIATION). Websockets supports this too and their implementation could maybe help.
Specification: https://tools.ietf.org/
The text was updated successfully, but these errors were encountered: