pub async fn accept_async<S, T>(stream: T) -> Result<WebSocketStream<S>, Error>where
S: Splittable + 'static,
<S as Splittable>::ReadHalf: AsyncRead + Unpin,
<S as Splittable>::WriteHalf: AsyncWrite + Unpin,
T: IntoMaybeTlsStream<S>,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.