pub async fn accept_with<S, E>(
    stream: S,
    config: WebSocketConfig,
    extension: E,
    subprotocols: ProtocolRegistry
) -> Result<WebSocketUpgrader<S, <E as ExtensionProvider>::Extension>, Error> where
    S: WebSocketStream,
    E: ExtensionProvider
Expand description

Execute a server handshake on the provided stream. An attempt will be made to negotiate the extension and subprotocols provided.

Returns either a WebSocketUpgrader that may be used to either accept or reject the peer or an error if the peer’s request is malformatted or if an IO error occurs. If the peer is accepted, then config, extension and subprotocols will be used for building the WebSocket.