pub fn connect_async<R>(
    request: R,
) -> Box<dyn Future<Item = (WebSocketStream<AutoStream<TcpStream>>, Response), Error = Error> + Send>
where
    R: Into<Request<'static>>,
{
    let request: Request = request.into();

    let domain = match domain(&request) {
        Ok(domain) => domain,
        Err(err) => return Box::new(future::err(err)),
    };
    let port = request
        .url
        .port_or_known_default()
        .expect("Bug: port unknown");

    Box::new(
        tokio_dns::TcpStream::connect((domain.as_str(), port))
            .map_err(|e| e.into())
            .and_then(move |socket| client_async_tls(request, socket)),
    )
}
/// Connect to a given URL.
Connect to a given URL.
Connect to a given URL .
pub fn connect_async<R>(
    request: R,
) -> Box<dyn Future<Item = (WebSocketStream<AutoStream<TcpStream>>, Response), Error = Error> + Send>
where
    R: Into<Request<'static>>,
{
    let request: Request = request.into();
    let domain = match domain(&request) {
        Ok(domain) => domain,
        Err(err) => return Box::new(future::err(err)),
    };
    let port = request
        .url
        .port_or_known_default()
        .expect("Bug: port unknown");
    Box::new(
        tokio_dns::TcpStream::connect((domain.as_str(), port))
            .map_err(|e| e.into())
            .and_then(move |socket| client_async_tls(request, socket)),
    )
}
pub fn connect_async < R > ( request : R , ) -> Box < dyn Future < Item = ( WebSocketStream < AutoStream < TcpStream > > , Response ) , Error = Error > + Send > where R : Into < Request < ' static > > , { let request : Request = request . into ( ) ; let domain = match domain ( & request ) { Ok ( domain ) => domain , Err ( err ) => return Box :: new ( future :: err ( err ) ) , } ; let port = request . url . port_or_known_default ( ) . expect ( " " ) ; Box :: new ( tokio_dns :: TcpStream :: connect ( ( domain . as_str ( ) , port ) ) . map_err ( | e | e . into ( ) ) . and_then ( move | socket | client_async_tls ( request , socket ) ) , ) }
Connect to a given URL.
Connect to a given URL .
request
R
request
R