pub fn connect_with_config<Req: IntoClientRequest>(
request: Req,
config: Option<WebSocketConfig>,
max_redirects: u8,
) -> Result<(WebSocket<MaybeTlsStream<TcpStream>>, Response)>
Expand description
Connect to the given WebSocket in blocking mode.
Uses a websocket configuration passed as an argument to the function. Calling it with None
is
equal to calling connect()
function.
The URL may be either ws:// or wss://. To support wss:// URLs, you must activate the TLS feature on the crate level. Please refer to the project’s README for more information on available features.
This function “just works” for those who wants a simple blocking solution
similar to std::net::TcpStream
. If you want a non-blocking or other
custom stream, call client
instead.
This function uses native_tls
or rustls
to do TLS depending on the feature flags enabled. If
you want to use other TLS libraries, use client
instead. There is no need to enable any of
the *-tls
features if you don’t call connect
since it’s the only function that uses them.