Skip to content

Send a custom HTTP header for "101 Upgrade" response #26

Description

@micolous

I need to be able to send a custom HTTP header in the 101 Upgrade response (as part of WebSocket connection initialisation), around about here:

if let Some(protocol) = protocol {
response.insert_header("Sec-Websocket-Protocol", protocol);
}
let http_res: &mut tide::http::Response = response.as_mut();
let upgrade_receiver = http_res.recv_upgrade().await;

It'd be nice to be able to have some extension to the handler so that my code can do some work to add this header in, and have some extra connection-level state along with the WebSocketStream.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions