EntropyEngine::Networking::WebRTCServer
EntropyEngine::Networking::WebRTCServer
Section titled “EntropyEngine::Networking::WebRTCServer”WebRTC-based implementation of RemoteServer. More…
#include <WebRTCServer.h>
Inherits from EntropyEngine::Networking::RemoteServer, EntropyEngine::Core::EntropyObject
Public Functions
Section titled “Public Functions”| Name | |
|---|---|
| ~WebRTCServer() override Destructor - ensures cleanup. | |
| WebRTCServer & | operator=(const WebRTCServer & ) =delete |
| virtual Result< void > | listen() override Start WebSocket signaling server. |
| virtual bool | isListening() const override Check if server is listening. |
| virtual Result< void > | close() override Close server and reject pending connections. |
| virtual ConnectionHandle | accept() override Accept an incoming WebRTC connection (blocking). |
| WebRTCServer(ConnectionManager * connMgr, const RemoteServerConfig & config) Construct WebRTC server with configuration. | |
| WebRTCServer(const WebRTCServer & ) =delete |
Additional inherited members
Section titled “Additional inherited members”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 | |
|---|---|
| struct | HandleCore 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. |
| bool | tryRetain() const Attempts to retain only if the object is still alive. |
| virtual std::string | toString() const Human-readable short string (class@ptr by default). |
| void | retain() const Increments the reference count. |
| void | release() const Decrements the reference count and deletes when it reaches zero. |
| uint32_t | refCount() const Current reference count (approximate under contention). |
| bool | hasHandle() const |
| template <class OwnerT > OwnerT * | handleOwnerAs() const Returns the stamped owner pointer cast to the requested type. |
| const void * | handleOwner() const |
| uint32_t | handleIndex() const |
| uint64_t | handleId() const |
| uint32_t | handleGeneration() const |
| WeakControlBlock * | getWeakControlBlock() const Lazily retrieves or creates the weak control block. |
| virtual std::string | description() const Long-form description; defaults to toString(). |
| virtual std::string | debugString() const Debug-oriented string including refcount and handle when present. |
| virtual const char * | className() const Runtime class name for diagnostics and reflection. |
| virtual uint64_t | classHash() 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 | |
|---|---|
| struct | HandleAccess |
Detailed Description
Section titled “Detailed Description”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
Public Functions Documentation
Section titled “Public Functions Documentation”function ~WebRTCServer
Section titled “function ~WebRTCServer”~WebRTCServer() overrideDestructor - ensures cleanup.
function operator=
Section titled “function operator=”WebRTCServer & operator=( const WebRTCServer &) =deletefunction listen
Section titled “function listen”virtual Result< void > listen() overrideStart WebSocket signaling server.
Return: Result indicating success or failure
Reimplements: EntropyEngine::Networking::RemoteServer::listen
function isListening
Section titled “function isListening”virtual bool isListening() const overrideCheck if server is listening.
Return: true if listening, false otherwise
Reimplements: EntropyEngine::Networking::RemoteServer::isListening
function close
Section titled “function close”virtual Result< void > close() overrideClose server and reject pending connections.
Return: Result indicating success or failure
Reimplements: EntropyEngine::Networking::RemoteServer::close
function accept
Section titled “function accept”virtual ConnectionHandle accept() overrideAccept 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.
function WebRTCServer
Section titled “function WebRTCServer”WebRTCServer( ConnectionManager * connMgr, const RemoteServerConfig & config)Construct WebRTC server with configuration.
Parameters:
- connMgr ConnectionManager to adopt connections
- config Server configuration
function WebRTCServer
Section titled “function WebRTCServer”WebRTCServer( const WebRTCServer &) =deleteUpdated on 2026-01-26 at 17:14:35 -0500