You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is problematic for my use case, where I would like to customize the CloseCode in the response (typically, I want the response to match the CloseCode of the closing request, so if the client closes with CloseCode::Library(4000) I want the server to respond with the same code).
Is there any way or workaround to make this work ?
The text was updated successfully, but these errors were encountered:
If an endpoint receives a Close frame and did not previously send a
Close frame, the endpoint MUST send a Close frame in response. (When
sending a Close frame in response, the endpoint typically echos the
status code it received.)
So perhaps we could echo the frame that we received when sending the response. I think that it would be indeed a better behavior and also should solve the problem you have.
Currently, when the closing handshake is initiated by the other side of the WebSocket connection, we can't customize the CloseFrame of the response: it is automatically set to
CloseFrame { code: CloseCode::Normal, reason: "".into() }
, cf https://github.com/snapview/tungstenite-rs/blob/master/src/protocol/mod.rs#L562-L565.This is problematic for my use case, where I would like to customize the CloseCode in the response (typically, I want the response to match the CloseCode of the closing request, so if the client closes with
CloseCode::Library(4000)
I want the server to respond with the same code).Is there any way or workaround to make this work ?
The text was updated successfully, but these errors were encountered: