pub async fn start_with<S, Err>(
req: &HttpRequest,
subprotocol: Option<&str>,
f: impl IntoService<S, WsSink, DispatchItem<WsSink>>,
) -> Result<(), WsError<Err>>Expand description
Start websocket service handling raw DispatchItem messages requiring manual control/stop logic,
including the chosen subprotocol in the response.
Unlike start(), pings and close frames are not answered automatically.
If subprotocol is Some, the Sec-Websocket-Protocol header will be included
in the response with the chosen protocol. The protocol must be a valid HTTP
token offered by the client. If None, the header is omitted.
If the handshake fails for an upgrade request, the handshake error response is sent and the connection is closed.
With the compress feature, the permessage-deflate extension is accepted
if it is enabled with
HttpServiceConfig::set_ws_deflate().