-
Notifications
You must be signed in to change notification settings - Fork 213
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
Conceptual question about WebSockets codes #364
Comments
1006 is the code for "we couldn't close the connection cleanly" (see https://www.rfc-editor.org/rfc/rfc6455.html) so it's the best one to use in this situation IMO! |
But the client is going to receive 500 status code. Is it fine? 🤔 |
Yes - the close code is not guaranteed to be what the client gets, and the spec says specifically in the case of an abnormal connection closure that 1006 is what to send. |
Aha. Perfect. Thanks Andrew! 😁🙏 |
Hi there 👋
When the handshake fails, what is the ASGI server supposed to send to the ASGI application?
Since the handshake failed,
uvicorn
sends a 500 to the client, and is sending awebsocket.disconnect
with 1006 code to the application. But... That code is "fake", as I'm not sending it to the client.What should be the expectation here? What should we send to the application?
The text was updated successfully, but these errors were encountered: