Skip to content
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

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

Open
micolous opened this issue Mar 15, 2023 · 0 comments
Open

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

micolous opened this issue Mar 15, 2023 · 0 comments

Comments

@micolous
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant