Skip to main content

UpgradeHandler

Type Alias UpgradeHandler 

Source
pub type UpgradeHandler = Arc<dyn Fn(TcpStream, Vec<u8>) -> Pin<Box<dyn Future<Output = ()> + Send>> + Send + Sync>;
Expand description

A protocol-upgrade handler: takes over a connection’s raw socket once the shared loop has completed the HTTP-level handshake (a GET <path> request carrying Upgrade: websocket, answered 101 Switching Protocols) — the socket, plus any bytes already read into the connection’s buffer past that request (almost always empty; a bodyless GET ends its own frame at the header block, but a pipelined first WS frame is possible and must not be dropped). Spawned as its own task by the loop, which then moves on to the next connection — the handler owns the socket for as long as it likes.

Aliased Type§

pub struct UpgradeHandler { /* private fields */ }