-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Correctly support websocket close codes #8975
Conversation
Added |
Just for the reference, here it is a list of error codes from IANA -> https://www.iana.org/assignments/websocket/websocket.xhtml#close-code-number |
This is essentially a bug in websockets right now, so I'd really like if this could make it into 0.34.0 because it's affecting a number of people I know. Changes to accept an enum could be made later. If the constant styling is unacceptable to the core team I'm happy to change it, but it'd be nice to merge this as-is right now... |
The first two bytes of the message in a WebSocket Close frame is a numeric code. Make sure to always encode this correctly, to avoid being in violation of the websocket spec. Also automatically decode this for clients. This is a breaking change since on_close now takes two arguments: close code and message, but this change was unable to be made in a backwards compatible way. Closes crystal-lang#6469 Closes crystal-lang#7483
d2c35ec
to
46723ce
Compare
Squashed and added the extra close codes from the registry. I'll merge this once CI passes. |
The first two bytes of the message in a WebSocket Close frame is anumeric code. Make sure to always encode this correctly, to avoid being in violation of the websocket spec. Also automatically decode this for clients.
This is a breaking change since on_close now takes two arguments: close code and message, but this change is unable to be made in a backwards compatible way.
Closes #6469