Function async_proto::websocket
source · pub async fn websocket<R: Protocol, W: Protocol>(
request: impl IntoClientRequest + Unpin
) -> Result<(impl Sink<W, Error = WriteError>, impl Stream<Item = Result<R, ReadError>>)>
Available on crate feature
tokio-tungstenite
only.Expand description
Establishes a WebSocket connection to the given URL and returns a typed sink/stream pair.
Useful for WebSocket connections where the message type per direction is always the same.