Function tokio_tungstenite::client_async [] [src]

pub fn client_async<'a, R, S>(request: R, stream: S) -> ConnectAsync<S> where
    R: Into<Request<'a>>,
    S: AsyncRead + AsyncWrite

Creates a WebSocket handshake from a request and a stream. For convenience, the user may call this with a url string, a URL, or a Request. Calling with Request allows the user to add a WebSocket protocol or other custom headers.

Internally, this custom creates 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 on whether the handshake is successful.

This is typically used for clients who have already established, for example, a TCP connection to the remove server.