-
Notifications
You must be signed in to change notification settings - Fork 24
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
Handle CLOSE reason as Incoming #31
Conversation
Co-authored-by: Pierre Krieger <pierre.krieger1708@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me after TODOs are fixed
…SE frame we should not bail early.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGMT, I don't know why we are now ignoring the errors on sending the ACK to close, but I also don't see how that would break anything.
Because otherwise we'd do an early exit and the code higher up the call chain would not see the |
Pass websocket CLOSE reason to the app as an `Incoming::Closed(soketto::CloseReason)`. This PR is a companion to paritytech/soketto#31 and lets applications know what the remote end claimed to be the reason for closing the connection (if any). `IncomingData` is now renamed to `Incoming` and the actual data (text or binary) is moved into its own `Data` enum, which in turn allows `into_bytes()` and the `AsRef` impl to apply more sanely to something that is actually data. Co-authored-by: David Palm <dvdplm@gmail.com>
Pass websocket CLOSE reason to the app as an `Incoming::Closed(soketto::CloseReason)`. This PR is a companion to paritytech/soketto#31 and lets applications know what the remote end claimed to be the reason for closing the connection (if any). `IncomingData` is now renamed to `Incoming` and the actual data (text or binary) is moved into its own `Data` enum, which in turn allows `into_bytes()` and the `AsRef` impl to apply more sanely to something that is actually data. Co-authored-by: David Palm <dvdplm@gmail.com>
When a remote sends us a CLOSE message it may contain a reason code and "application data" with further details about why the connection was closed.
Before this PR there was no way for applications using
soketto
to know what the code/data was sent from the remote.Further context here.
This is an alternative to #29 and returns the close reason as
Incoming::Closed
instead ofError::Closed(reason)
.