pub async fn accept_async<S>(stream: S) -> Result<WebSocketStream<S>, Error>where
S: AsyncRead + AsyncWrite,Available on crate feature
ws only.Expand description
Accepts a new WebSocket connection with the provided stream.
This function will internally 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 WsError
depending on 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 accepting a client’s websocket connection.