Skip to content

EntropyEngine::Networking::WebRTCServer

WebRTC-based implementation of RemoteServer. More…

#include <WebRTCServer.h>

Inherits from EntropyEngine::Networking::RemoteServer, EntropyEngine::Core::EntropyObject

Name
~WebRTCServer() override
Destructor - ensures cleanup.
WebRTCServer &operator=(const WebRTCServer & ) =delete
virtual Result< void >listen() override
Start WebSocket signaling server.
virtual boolisListening() const override
Check if server is listening.
virtual Result< void >close() override
Close server and reject pending connections.
virtual ConnectionHandleaccept() override
Accept an incoming WebRTC connection (blocking).
WebRTCServer(ConnectionManager * connMgr, const RemoteServerConfig & config)
Construct WebRTC server with configuration.
WebRTCServer(const WebRTCServer & ) =delete

Public Functions inherited from EntropyEngine::Networking::RemoteServer

Name
virtual~RemoteServer() =default

Protected Functions inherited from EntropyEngine::Networking::RemoteServer

Name
RemoteServer() =default
Protected constructor - use factory functions.

Protected Classes inherited from EntropyEngine::Core::EntropyObject

Name
structHandleCore
Optional handle identity stamped by an owner/registry.

Public Functions inherited from EntropyEngine::Core::EntropyObject

Name
virtual~EntropyObject() =default
virtual const TypeSystem::TypeInfo *typeInfo() const
Optional richer type information; may be null.
booltryRetain() const
Attempts to retain only if the object is still alive.
virtual std::stringtoString() const
Human-readable short string (class@ptr by default).
voidretain() const
Increments the reference count.
voidrelease() const
Decrements the reference count and deletes when it reaches zero.
uint32_trefCount() const
Current reference count (approximate under contention).
boolhasHandle() const
template <class OwnerT >
OwnerT *
handleOwnerAs() const
Returns the stamped owner pointer cast to the requested type.
const void *handleOwner() const
uint32_thandleIndex() const
uint64_thandleId() const
uint32_thandleGeneration() const
WeakControlBlock *getWeakControlBlock() const
Lazily retrieves or creates the weak control block.
virtual std::stringdescription() const
Long-form description; defaults to toString().
virtual std::stringdebugString() const
Debug-oriented string including refcount and handle when present.
virtual const char *className() const
Runtime class name for diagnostics and reflection.
virtual uint64_tclassHash() const
Stable type hash for cross-language identification.
EntropyObject() =default
EntropyObject(EntropyObject && ) =delete
EntropyObject(const EntropyObject & ) =delete

Protected Functions inherited from EntropyEngine::Core::EntropyObject

Name
void_setHandleIdentity(void * owner, uint32_t index, uint32_t generation)
void_clearHandleIdentity()

Protected Attributes inherited from EntropyEngine::Core::EntropyObject

Name
std::atomic< WeakControlBlock * >_weakBlock
Lazily allocated control block for weak refs.
std::atomic< uint32_t >_refCount
Thread-safe retain/release counter.
struct EntropyEngine::Core::EntropyObject::HandleCore_handle

Friends inherited from EntropyEngine::Core::EntropyObject

Name
structHandleAccess
class EntropyEngine::Networking::WebRTCServer;

WebRTC-based implementation of RemoteServer.

WebRTCServer handles WebRTC connections using WebSocket signaling. It manages the WebSocket server internally and queues incoming WebRTC connections for accept().

Architecture:

  • WebSocket signaling server runs on configured port
  • Incoming WebSocket connections trigger WebRTC setup
  • Completed WebRTC connections are queued for accept()
  • Perfect negotiation: server is impolite peer

Thread Safety:

  • All methods are thread-safe
  • accept() can be called from multiple threads
  • Internal queue protected by mutex
  • Condition variable for efficient blocking

Implementation Details:

  • WebSocket callbacks run on libdatachannel threads
  • Signaling messages handled internally
  • Connection adoption handled automatically
  • Cleanup on close() or destruction
~WebRTCServer() override

Destructor - ensures cleanup.

WebRTCServer & operator=(
const WebRTCServer &
) =delete
virtual Result< void > listen() override

Start WebSocket signaling server.

Return: Result indicating success or failure

Reimplements: EntropyEngine::Networking::RemoteServer::listen

virtual bool isListening() const override

Check if server is listening.

Return: true if listening, false otherwise

Reimplements: EntropyEngine::Networking::RemoteServer::isListening

virtual Result< void > close() override

Close server and reject pending connections.

Return: Result indicating success or failure

Reimplements: EntropyEngine::Networking::RemoteServer::close

virtual ConnectionHandle accept() override

Accept an incoming WebRTC connection (blocking).

Return: ConnectionHandle for completed connection, or invalid if closed

Reimplements: EntropyEngine::Networking::RemoteServer::accept

Blocks until:

  • A WebRTC connection completes and is queued
  • The server is closed

Uses condition variable for efficient waiting.

WebRTCServer(
ConnectionManager * connMgr,
const RemoteServerConfig & config
)

Construct WebRTC server with configuration.

Parameters:

WebRTCServer(
const WebRTCServer &
) =delete

Updated on 2026-01-26 at 17:14:35 -0500