tungstenite

Function accept_with_config

Source
pub fn accept_with_config<S: Read + Write>(
    stream: S,
    config: Option<WebSocketConfig>,
) -> Result<WebSocket<S>, HandshakeError<ServerHandshake<S, NoCallback>>>
Expand description

Accept the given Stream as a WebSocket.

Uses a configuration provided as an argument. Calling it with None will use the default one used by accept().

This function starts a server WebSocket handshake over the given stream. If you want TLS support, use native_tls::TlsStream, rustls::Stream or openssl::ssl::SslStream for the stream here. Any Read + Write streams are supported, including those from Mio and others.