ws_handler

Function ws_handler 

Source
pub async fn ws_handler(
    ws: WebSocketUpgrade,
    __arg1: State<Arc<WebSocketState>>,
) -> Response
Expand description

Handles the WebSocket upgrade request.

This function is an Axum handler that takes a WebSocketUpgrade and a WebSocketState, then upgrades the connection to a WebSocket and spawns a task to handle the socket.

§Arguments

  • ws - The WebSocketUpgrade extractor.
  • State(state) - The shared WebSocketState.

§Returns

An Axum Response.