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

Fronts an in-process SignallingService over a WebSocket. More...

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

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

Classes

struct  State
 

Public Member Functions

 ~WebSocketSignallingServer ()
 
absl::Status Stop ()
 Stops the server and closes all client connections.
 
absl::Status Disconnect (std::string_view identity)
 Closes one identity's connection, if this server holds it.
 
std::uint16_t port () const
 
bool running () const
 
std::shared_ptr< SignallingService > service () const
 
void *absl_nullable GetImpl () const
 

Static Public Member Functions

static absl::StatusOr< std::shared_ptr< WebSocketSignallingServer > > Create (std::shared_ptr< SignallingService > service, WebSocketSignallingServerOptions options={})
 Creates a WebSocket signalling server fronting service.
 

Detailed Description

Fronts an in-process SignallingService over a WebSocket.

Lets remote peers join the same signalling fabric: each connecting WebSocketSignallingClient is registered with the wrapped SignallingService under its identity, so messages route between local and remote peers alike.

Constructor & Destructor Documentation

◆ ~WebSocketSignallingServer()

a11::net::WebSocketSignallingServer::~WebSocketSignallingServer ( )

Member Function Documentation

◆ Create()

absl::StatusOr< std::shared_ptr< WebSocketSignallingServer > > a11::net::WebSocketSignallingServer::Create ( std::shared_ptr< SignallingService >  service,
WebSocketSignallingServerOptions  options = {} 
)
static

Creates a WebSocket signalling server fronting service.

Parameters
serviceThe in-process signalling service to expose.
optionsListen address, port, path prefix, and limits.
Returns
The running server, or an error status.

◆ Disconnect()

absl::Status a11::net::WebSocketSignallingServer::Disconnect ( std::string_view  identity)

Closes one identity's connection, if this server holds it.

The counterpart to admission: whatever authorised a registration can be withdrawn – a credential expires, a lease is taken by somebody else – and the socket has to go with it rather than surviving until its next message. on_departed fires as it would for a voluntary disconnect, so bookkeeping has one path rather than two.

Parameters
identityThe registered identity to disconnect.
Returns
OK, or NOT_FOUND when this server is not holding it.

◆ GetImpl()

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

◆ port()

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

◆ running()

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

◆ service()

std::shared_ptr< SignallingService > a11::net::WebSocketSignallingServer::service ( ) const
Returns
The signalling service this server fronts.

◆ Stop()

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

Stops the server and closes all client connections.


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