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

Hosts HTTP SSE wire streams on top of an HTTP/2 server. More...

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

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

Classes

struct  State
 

Public Member Functions

 ~HttpSseServer ()
 
a11::Future< std::shared_ptr< HttpSseServerWireStream > > WaitForStream ()
 
absl::Status Stop ()
 Stops the server and releases its resources.
 
std::uint16_t port () const
 
bool running () const
 
std::shared_ptr< Http2Serverhttp2_server () const
 

Static Public Member Functions

static absl::StatusOr< std::shared_ptr< HttpSseServer > > Create (std::string bind_address, std::uint16_t port, OnHttpSseConnect on_connect={}, HttpSseOptions options={})
 Creates and starts an SSE server accepting A11 wire streams.
 

Friends

class HttpSseServerWireStream
 

Detailed Description

Hosts HTTP SSE wire streams on top of an HTTP/2 server.

Accepts A11 clients connecting over HTTP/2 SSE. Either supply an on_connect callback invoked per stream, or pull streams explicitly with WaitForStream().

Constructor & Destructor Documentation

◆ ~HttpSseServer()

a11::net::HttpSseServer::~HttpSseServer ( )

Member Function Documentation

◆ Create()

absl::StatusOr< std::shared_ptr< HttpSseServer > > a11::net::HttpSseServer::Create ( std::string  bind_address,
std::uint16_t  port,
OnHttpSseConnect  on_connect = {},
HttpSseOptions  options = {} 
)
static

Creates and starts an SSE server accepting A11 wire streams.

Parameters
bind_addressLocal address to bind to.
portTCP port to listen on; 0 selects an ephemeral port.
on_connectOptional callback invoked for each accepted stream.
optionsEndpoint paths and transport tuning.
Returns
The running server, or an error status.

◆ http2_server()

std::shared_ptr< Http2Server > a11::net::HttpSseServer::http2_server ( ) const
Returns
The underlying HTTP/2 server.

◆ port()

std::uint16_t a11::net::HttpSseServer::port ( ) const
Returns
The port listened on, resolved even for an ephemeral 0.

◆ running()

bool a11::net::HttpSseServer::running ( ) const
Returns
Whether the server is currently running.

◆ Stop()

absl::Status a11::net::HttpSseServer::Stop ( )

Stops the server and releases its resources.

◆ WaitForStream()

a11::Future< std::shared_ptr< HttpSseServerWireStream > > a11::net::HttpSseServer::WaitForStream ( )
Returns
An awaitable resolving to the next incoming SSE wire stream.

Friends And Related Symbol Documentation

◆ HttpSseServerWireStream


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