pub async fn connect_async<R>(
    request: R,
) -> Result<(WebSocketStream<AutoStream<TcpStream>>, Response), Error>
where
    R: Into<Request<'static>> + Unpin,
{
    let request: Request = request.into();

    let domain = domain(&request)?;
    let port = request
        .url
        .port_or_known_default()
        .expect("Bug: port unknown");

    let addr = format!("{}:{}", domain, port);
    let try_socket = TcpStream::connect(addr).await;
    let socket = try_socket.map_err(Error::Io)?;
    client_async_tls(request, socket).await
}
/// Connect to a given URL.
Connect to a given URL.
Connect to a given URL .
pub async fn connect_async<R>(
    request: R,
) -> Result<(WebSocketStream<AutoStream<TcpStream>>, Response), Error>
where
    R: Into<Request<'static>> + Unpin,
{
    let request: Request = request.into();
    let domain = domain(&request)?;
    let port = request
        .url
        .port_or_known_default()
        .expect("Bug: port unknown");
    let addr = format!("{}:{}", domain, port);
    let try_socket = TcpStream::connect(addr).await;
    let socket = try_socket.map_err(Error::Io)?;
    client_async_tls(request, socket).await
}
pub async fn connect_async < R > ( request : R , ) -> Result < ( WebSocketStream < AutoStream < TcpStream > > , Response ) , Error > where R : Into < Request < ' static > > + Unpin , { let request : Request = request . into ( ) ; let domain = domain ( & request ) ? ; let port = request . url . port_or_known_default ( ) . expect ( " " ) ; let addr = format ! ( " " domain port ) ; let try_socket = TcpStream :: connect ( addr ) . await ; let socket = try_socket . map_err ( Error :: Io ) ? ; client_async_tls ( request , socket ) . await }
Connect to a given URL.
Connect to a given URL .
request
R