perspective::axum

Function websocket_handler

Source
pub fn websocket_handler() -> MethodRouter<Server>
Expand description

This handler is responsible for the beginning-to-end lifecycle of a single WebSocket connection to an axum server.

Messages will come in from the axum::extract::ws::WebSocket in binary form via Message::Binary, where they’ll be routed to [perspective::Session::handle_request]. The server may generate one or more responses, which it will then send back to the axum::extract::ws::WebSocket::send method via its SessionHandler impl.