Function h2::client::handshake[][src]

pub async fn handshake<T>(
    io: T
) -> Result<(SendRequest<Bytes>, Connection<T, Bytes>), Error> where
    T: AsyncRead + AsyncWrite + Unpin
Expand description

Creates a new configured HTTP/2 client with default configuration values backed by io.

It is expected that io already be in an appropriate state to commence the HTTP/2 handshake. See Handshake for more details.

Returns a future which resolves to the Connection / SendRequest tuple once the HTTP/2 handshake has been completed. The returned Connection instance will be using default configuration values. Use Builder to customize the configuration values used by a Connection instance.

Examples

let (send_request, connection) = client::handshake(my_io).await?;
// The HTTP/2 handshake has completed, now start polling
// `connection` and use `send_request` to send requests to the
// server.