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

    let domain = match domain(&request) {
        Ok(domain) => domain,
        Err(err) => return Box::new(future::err(err)),
    };

    // Make sure we check domain and mode first. URL must be valid.
    let mode = match url_mode(&request.url) {
        Ok(m) => m,
        Err(e) => return Box::new(future::err(e)),
    };

    Box::new(
        wrap_stream(stream, domain, mode)
            .and_then(|mut stream| {
                NoDelay::set_nodelay(&mut stream, true)
                    .map(move |()| stream)
                    .map_err(|e| e.into())
            })
            .and_then(move |stream| client_async(request, stream)),
    )
}
/// Creates a WebSocket handshake from a request and a stream,
/// upgrading the stream to TLS if required.
Creates a WebSocket handshake from a request and a stream,
upgrading the stream to TLS if required.
Creates a WebSocket handshake from a request and a stream upgrading the stream to TLS if required .
pub fn client_async_tls<R, S>(
    request: R,
    stream: S,
) -> Box<dyn Future<Item = (WebSocketStream<AutoStream<S>>, Response), Error = Error> + Send>
where
    R: Into<Request<'static>>,
    S: 'static + AsyncRead + AsyncWrite + NoDelay + Send,
{
    let request: Request = request.into();
    let domain = match domain(&request) {
        Ok(domain) => domain,
        Err(err) => return Box::new(future::err(err)),
    };
    // Make sure we check domain and mode first. URL must be valid.
    let mode = match url_mode(&request.url) {
        Ok(m) => m,
        Err(e) => return Box::new(future::err(e)),
    };
    Box::new(
        wrap_stream(stream, domain, mode)
            .and_then(|mut stream| {
                NoDelay::set_nodelay(&mut stream, true)
                    .map(move |()| stream)
                    .map_err(|e| e.into())
            })
            .and_then(move |stream| client_async(request, stream)),
    )
}
pub fn client_async_tls < R , S > ( request : R , stream : S , ) -> Box < dyn Future < Item = ( WebSocketStream < AutoStream < S > > , Response ) , Error = Error > + Send > where R : Into < Request < ' static > > , S : ' static + AsyncRead + AsyncWrite + NoDelay + Send , { let request : Request = request . into ( ) ; let domain = match domain ( & request ) { Ok ( domain ) => domain , Err ( err ) => return Box :: new ( future :: err ( err ) ) , } ; // Make sure we check domain and mode first. URL must be valid. let mode = match url_mode ( & request . url ) { Ok ( m ) => m , Err ( e ) => return Box :: new ( future :: err ( e ) ) , } ; Box :: new ( wrap_stream ( stream , domain , mode ) . and_then ( | mut stream | { NoDelay :: set_nodelay ( & mut stream , true ) . map ( move | ( ) | stream ) . map_err ( | e | e . into ( ) ) } ) . and_then ( move | stream | client_async ( request , stream ) ) , ) }
Creates a WebSocket handshake from a request and a stream,
upgrading the stream to TLS if required.
Creates a WebSocket handshake from a request and a stream upgrading the stream to TLS if required .
request
R
stream
S
request
R
stream
S