-
Notifications
You must be signed in to change notification settings - Fork 940
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 code&reason in libp2p-websocket #2021
Comments
This is incorrect. |
If I am not mistaken, this is fixed via #2319. I am closing here. |
When a websocket is closed the closer may provide a code and optionally a reason for why the connection was closed (see rfc 5.5.1 and rfc 7.1.6 for details). Currently
libp2p
does not propagate this information to applications.On the lower layer,
soketto
supports returning reason code](https://github.com/paritytech/soketto/blob/c02379dead28966a50c34dc4b2a6887d52c7ccd2/src/connection.rs#L365-L379) (but the user data is tossed away here).We could change
IncomingData
to include aClose
variant that carries the reason code&string and make sure the stream is closed properly after a Close frame was received.The motivation for this is
substrate-telemetry
where an overloaded websocket server could use a way to tell connecting clients to back off, using the1013 Try again later
, or to inform them they are not allowed to connect at all using the1008 Policy violation
codes. Currently, clients connected usinglibp2p-websocket
get a genericstd::io::Error
along the lines ofError: Custom { kind: Other, error: B(Custom { kind: Other, error: Closed }) }
after a remote hung up on them.See here for a full list of (semi-)standard status codes.
The text was updated successfully, but these errors were encountered: