Skip to main content

subscription_handler

Function subscription_handler 

Source
pub async fn subscription_handler(
    headers: HeaderMap,
    ws: WebSocketUpgrade,
    __arg2: State<SubscriptionState>,
) -> impl IntoResponse
Expand description

WebSocket upgrade handler for subscriptions.

Negotiates the WebSocket sub-protocol from the Sec-WebSocket-Protocol header. Supports graphql-transport-ws (modern) and graphql-ws (legacy). Defaults to graphql-transport-ws when no header is present. Returns 400 Bad Request for unrecognised protocols.