Skip to content

Choose close code and reason on response #245

@ErwanDL

Description

@ErwanDL

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 ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions