pub async fn connect<R>(
request: R,
timeout: Duration,
) -> Result<BoxSocket, WsError>where
R: IntoClientRequest + Unpin,Expand description
Open a connection through the target’s default SocketTransport
and runtime, giving up after timeout.
request is a URL, or a handshake request with its own headers, built
afresh for each attempt so any authentication in it is recomputed. A
connection not open within timeout fails as Kind::ConnectTimeout;
every other failure is the transport’s, such as Kind::Refused for an
upgrade the server answered with an HTTP status. A caller that injects its
own transport or runtime opens its connections through them instead.