Function tokio_tungstenite::accept_async[][src]

pub fn accept_async<S>(stream: S) -> AcceptAsync<S, NoCallback> where
    S: AsyncRead + AsyncWrite

Accepts a new WebSocket connection with the provided stream.

This function will internally call server::accept to create a handshake representation and returns a future representing the resolution of the WebSocket handshake. The returned future will resolve to either WebSocketStream<S> or Error depending if it's successful or not.

This is typically used after a socket has been accepted from a TcpListener. That socket is then passed to this function to perform the server half of the accepting a client's websocket connection.