A11 (C++ runtime)
Native C++ implementation of the A11 action and streaming runtime
Loading...
Searching...
No Matches
a11::net::Http2Client Class Reference

An HTTP/2 client connection, reusable across many streams. More...

#include <cpp/a11/net/http2.h>

Inheritance diagram for a11::net::Http2Client:
[legend]

Classes

struct  Impl
 

Public Member Functions

 ~Http2Client ()
 
absl::StatusOr< std::shared_ptr< Http2ResponseStream > > RequestStream (std::string method, std::string path, HttpHeaders headers={}, std::string body={}, std::string scheme={})
 Opens a request and returns a pull-oriented response body stream.
 
absl::StatusOr< std::shared_ptr< Http2DuplexStream > > ExtendedConnect (std::string protocol, std::string path, HttpHeaders headers={}, std::string scheme={})
 Opens an extended CONNECT duplex stream for bidirectional data.
 
a11::Future< HttpResponseRequest (std::string method, std::string path, HttpHeaders headers={}, std::string body={}, std::string scheme={})
 
absl::Status Close ()
 Closes the client connection.
 
std::string host () const
 
std::uint16_t port () const
 
bool connected () const
 
bool secure () const
 
void *absl_nullable GetImpl () const
 

Static Public Member Functions

static a11::Future< std::shared_ptr< Http2Client > > Connect (std::string host, std::uint16_t port, Http2Options options={})
 Asynchronously connects to an HTTP/2 server.
 

Detailed Description

An HTTP/2 client connection, reusable across many streams.

Issues buffered requests, incremental response streams, or extended CONNECT duplex streams over a single connection. Shared as the transport backing HTTP SSE and WebSocket client wire streams.

Constructor & Destructor Documentation

◆ ~Http2Client()

a11::net::Http2Client::~Http2Client ( )

Member Function Documentation

◆ Close()

absl::Status a11::net::Http2Client::Close ( )

Closes the client connection.

◆ Connect()

a11::Future< std::shared_ptr< Http2Client > > a11::net::Http2Client::Connect ( std::string  host,
std::uint16_t  port,
Http2Options  options = {} 
)
static

Asynchronously connects to an HTTP/2 server.

Parameters
hostServer hostname.
portServer port.
optionsBody limits, buffering, deadline, and TLS settings.
Returns
An awaitable that resolves to the connected client.

◆ connected()

bool a11::net::Http2Client::connected ( ) const
Returns
Whether the client is currently connected.

◆ ExtendedConnect()

absl::StatusOr< std::shared_ptr< Http2DuplexStream > > a11::net::Http2Client::ExtendedConnect ( std::string  protocol,
std::string  path,
HttpHeaders  headers = {},
std::string  scheme = {} 
)

Opens an extended CONNECT duplex stream for bidirectional data.

◆ GetImpl()

void *absl_nullable a11::net::Http2Client::GetImpl ( ) const
Returns
An opaque native handle for advanced interop, or nullptr.

◆ host()

std::string a11::net::Http2Client::host ( ) const
Returns
The host the client is connected to.

◆ port()

std::uint16_t a11::net::Http2Client::port ( ) const
Returns
The port the client is connected to.

◆ Request()

a11::Future< HttpResponse > a11::net::Http2Client::Request ( std::string  method,
std::string  path,
HttpHeaders  headers = {},
std::string  body = {},
std::string  scheme = {} 
)
Returns
An awaitable resolving to the fully buffered response.

◆ RequestStream()

absl::StatusOr< std::shared_ptr< Http2ResponseStream > > a11::net::Http2Client::RequestStream ( std::string  method,
std::string  path,
HttpHeaders  headers = {},
std::string  body = {},
std::string  scheme = {} 
)

Opens a request and returns a pull-oriented response body stream.

◆ secure()

bool a11::net::Http2Client::secure ( ) const
Returns
Whether the connection is using TLS.

The documentation for this class was generated from the following files: