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

An in-process broker that routes signalling messages by identity. More...

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

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

Classes

struct  State
 

Public Member Functions

 ~SignallingService ()
 
absl::StatusOr< std::shared_ptr< SignallingEndpoint > > Connect (std::string identity, OnSignallingMessage on_message)
 Registers an identity and its inbound-message callback.
 
absl::Status Deliver (SignallingMessage message)
 Delivers a message to a locally connected recipient.
 
bool Contains (std::string_view identity) const
 
std::vector< std::string > Identities () const
 
absl::Status Stop ()
 Stops the service and disconnects all endpoints.
 

Static Public Member Functions

static std::shared_ptr< SignallingService > Create ()
 

Friends

class SignallingEndpoint
 

Detailed Description

An in-process broker that routes signalling messages by identity.

Each peer registers an identity and inbound callback via Connect(); a message's recipient field selects the endpoint it is delivered to. Used to bootstrap WebRTC peers in the same process, and fronted by WebSocketSignallingServer when peers are remote.

Constructor & Destructor Documentation

◆ ~SignallingService()

a11::net::SignallingService::~SignallingService ( )

Member Function Documentation

◆ Connect()

absl::StatusOr< std::shared_ptr< SignallingEndpoint > > a11::net::SignallingService::Connect ( std::string  identity,
OnSignallingMessage  on_message 
)

Registers an identity and its inbound-message callback.

Parameters
identityIdentity other peers address messages to.
on_messageAsync callback invoked for each inbound message.
Returns
The connected endpoint, or an error status.

◆ Contains()

bool a11::net::SignallingService::Contains ( std::string_view  identity) const
Returns
Whether the given identity is currently connected.

◆ Create()

std::shared_ptr< SignallingService > a11::net::SignallingService::Create ( )
static
Returns
A new, empty in-process signalling service.

◆ Deliver()

absl::Status a11::net::SignallingService::Deliver ( SignallingMessage  message)

Delivers a message to a locally connected recipient.

The ingress half of a federated signalling fabric: Route() carries a message from an endpoint this service holds, and Deliver() carries one that arrived from somewhere else – another process, another host – and needs placing into the recipient's queue as though it had. Paired with WebSocketSignallingServerOptions::on_unroutable, which is the egress half, it lets several servers behave as one without either of them knowing how the messages travel between them.

The message's sender is taken as given, because the caller is the only party that knows whether it was authenticated. A transport handing this untrusted input must set sender itself.

Parameters
messageThe message to deliver; its recipient selects the target.
Returns
OK, NOT_FOUND when the recipient is not connected here, or the recipient's terminal status when it is disconnecting.

◆ Identities()

std::vector< std::string > a11::net::SignallingService::Identities ( ) const
Returns
The list of currently connected identities.

◆ Stop()

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

Stops the service and disconnects all endpoints.

Friends And Related Symbol Documentation

◆ SignallingEndpoint

friend class SignallingEndpoint
friend

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