Rebel Fork Framework
Urho3D::DataChannelServer Class Reference
Inheritance diagram for Urho3D::DataChannelServer:
Urho3D::NetworkServer Urho3D::Object Urho3D::RefCounted

Public Member Functions

 DataChannelServer (Context *context)
 
bool Listen (const URL &url) override
 Supports "ws" and "wss" schemes. "wss" scheme requires calling SetTLSCertificate before calling Listen.
 
void Stop () override
 Stop listening and disconnect all clients.
 
bool IsListening () const override
 Return true if server is currently listening for incoming connections.
 
void SetTLSCertificate (ea::string_view certificatePemFile, ea::string_view keyPemFile, ea::string_view keyPassword)
 
void SetIceServers (const StringVector &servers)
 
void SetPortRange (unsigned begin, unsigned end)
 
void SetIceUdpMux (bool enable)
 
void SetIceTransportPolicy (rtc::TransportPolicy policy)
 
void SetBindAddress (ea::string_view address)
 Bind to a specific local address for all new connections (multi-homed servers).
 
void SetMtu (unsigned mtu)
 Override network MTU for all new connections (0 = use default).
 
- Public Member Functions inherited from Urho3D::NetworkServer
 NetworkServer (Context *context)
 
const ea::vector< SharedPtr< NetworkConnection > > & GetConnections () const
 Return snapshot of active connections.
 
void SetConnectionFactory (ea::function< SharedPtr< NetworkConnection >()> factory)
 Set factory for creating connection instances. Must be set before calling Listen.
 
SharedPtr< NetworkConnectionCreateConnection ()
 Creates a new connection instance. May be called from non-main thread.
 
- Public Member Functions inherited from Urho3D::Object
 Object (Context *context)
 Construct.
 
 ~Object () override
 Destruct. Clean up self from event sender & receiver structures.
 
virtual StringHash GetType () const =0
 
virtual const ea::string & GetTypeName () const =0
 
virtual const TypeInfoGetTypeInfo () const =0
 Return type info.
 
virtual bool IsInstanceOf (StringHash type) const =0
 Check whether current instance implements specified type.
 
virtual void OnEvent (Object *sender, StringHash eventType, VariantMap &eventData)
 Handle event.
 
virtual void SerializeInBlock (Archive &archive)
 Serialize content from/to archive. May throw ArchiveException.
 
template<typename T >
bool IsInstanceOf () const
 Check current instance is type of specified class.
 
template<typename T >
T * Cast ()
 Cast the object to specified most derived class.
 
template<typename T >
const T * Cast () const
 Cast the object to specified most derived class.
 
void SubscribeToEventManual (StringHash eventType, EventHandler *handler)
 Subscribe to an event that can be sent by any sender.
 
void SubscribeToEventManual (Object *sender, StringHash eventType, EventHandler *handler)
 Subscribe to a specific sender's event.
 
template<class T >
void SubscribeToEvent (StringHash eventType, T handler)
 Subscribe to an event that can be sent by any sender.
 
template<class T >
void SubscribeToEvent (Object *sender, StringHash eventType, T handler)
 Subscribe to a specific sender's event.
 
void UnsubscribeFromEvent (StringHash eventType)
 Unsubscribe from an event.
 
void UnsubscribeFromEvent (Object *sender, StringHash eventType)
 Unsubscribe from a specific sender's event.
 
void UnsubscribeFromEvents (Object *sender)
 Unsubscribe from a specific sender's events.
 
void UnsubscribeFromAllEvents ()
 Unsubscribe from all events.
 
void UnsubscribeFromAllEventsExcept (const ea::vector< StringHash > &exceptions)
 Unsubscribe from all events except those listed.
 
void UnsubscribeFromAllEventsExcept (const ea::vector< Object * > &exceptions)
 Unsubscribe from all events except those with listed senders.
 
void SendEvent (StringHash eventType)
 Send event to all subscribers.
 
void SendEvent (StringHash eventType, VariantMap &eventData)
 Send event with parameters to all subscribers.
 
VariantMap & GetEventDataMap () const
 Return a preallocated map for event data. Used for optimization to avoid constant re-allocation of event data maps.
 
template<typename... Args>
void SendEvent (StringHash eventType, const Args &... args)
 Send event with variadic parameter pairs to all subscribers. The parameters are (paramID, paramValue) pairs.
 
ContextGetContext () const
 Return execution context.
 
const VariantGetGlobalVar (StringHash key) const
 
const VariantMap & GetGlobalVars () const
 
void SetGlobalVar (StringHash key, const Variant &value)
 
ObjectGetSubsystem (StringHash type) const
 Return subsystem by type.
 
ObjectGetEventSender () const
 Return active event sender. Null outside event handling.
 
EventHandlerGetEventHandler () const
 Return active event handler. Null outside event handling.
 
bool HasSubscribedToEvent (StringHash eventType) const
 Return whether has subscribed to an event without specific sender.
 
bool HasSubscribedToEvent (Object *sender, StringHash eventType) const
 Return whether has subscribed to a specific sender's event.
 
bool HasEventHandlers () const
 Return whether has subscribed to any event.
 
template<class T >
T * GetSubsystem () const
 Template version of returning a subsystem.
 
const ea::string & GetCategory () const
 
void SendEvent (StringHash eventType, const VariantMap &eventData)
 Send event with parameters to all subscribers.
 
void SetBlockEvents (bool block)
 Block object from sending and receiving events.
 
bool GetBlockEvents () const
 Return sending and receiving events blocking status.
 
- Public Member Functions inherited from Urho3D::RefCounted
 RefCounted ()
 Construct. Allocate the reference count structure and set an initial self weak reference.
 
virtual ~RefCounted ()
 Destruct. Mark as expired and also delete the reference count structure if no outside weak references exist.
 
 RefCounted (const RefCounted &rhs)=delete
 Prevent copy construction.
 
RefCountedoperator= (const RefCounted &rhs)=delete
 Prevent assignment.
 
int AddRef () const
 
int ReleaseRef () const
 
int Refs () const
 
int WeakRefs () const
 
RefCountRefCountPtr () const
 Return pointer to the reference count structure.
 
bool HasScriptObject () const
 Return true if script runtime object wrapping this native object exists.
 
bool IsScriptStrongRef () const
 Return true if script reference is strong.
 

Static Public Member Functions

static void RegisterObject (Context *context)
 
- Static Public Member Functions inherited from Urho3D::Object
static const TypeInfoGetTypeInfoStatic ()
 Return type info static.
 

Protected Attributes

ea::shared_ptr< rtc::WebSocketServer > webSocketServer_
 
ea::string certificatePemFile_
 
ea::string keyPemFile_
 
ea::string keyPassword_
 
StringVector iceServers_
 
unsigned portRangeBegin_ = 1024
 
unsigned portRangeEnd_ = 65535
 
bool enableIceUdpMux_ {}
 
rtc::TransportPolicy iceTransportPolicy_ {}
 
ea::string bindAddress_
 
unsigned mtu_ {}
 
- Protected Attributes inherited from Urho3D::Object
WeakPtr< Contextcontext_
 Execution context.
 

Private Member Functions

 URHO3D_OBJECT (DataChannelServer, NetworkServer)
 

Friends

class DataChannelConnection
 

Additional Inherited Members

- Public Attributes inherited from Urho3D::NetworkServer
Signal< void(NetworkConnection *), NetworkServerOnConnected
 
Signal< void(NetworkConnection *), NetworkServerOnDisconnected
 
Signal< void(), NetworkServerOnListenStart
 
Signal< void(), NetworkServerOnListenStop
 
- Static Public Attributes inherited from Urho3D::Object
static constexpr ea::array< StringHash, 0 > TypeHierarchy {}
 
- Protected Member Functions inherited from Urho3D::NetworkServer
void NotifyStopping ()
 Notify Network subsystem that teardown has started.
 
void AddConnection (const SharedPtr< NetworkConnection > &connection)
 
void RemoveConnection (const SharedPtr< NetworkConnection > &connection)
 
virtual void HandleConnected (const SharedPtr< NetworkConnection > &connection)
 
virtual void HandleDisconnected (const SharedPtr< NetworkConnection > &connection)
 
virtual void HandleListenStart ()
 Called once, when server starts listening. Is called from the main thread.
 
virtual void HandleListenStop ()
 Called once, when server stops listening. Is called from the main thread.
 
void DispatchConnected (const SharedPtr< NetworkConnection > &connection)
 
void DispatchDisconnected (const SharedPtr< NetworkConnection > &connection)
 
void DispatchListenStart ()
 
void DispatchListenStop ()
 

Member Function Documentation

◆ IsListening()

bool Urho3D::DataChannelServer::IsListening ( ) const
overridevirtual

Return true if server is currently listening for incoming connections.

Implements Urho3D::NetworkServer.

◆ Listen()

bool Urho3D::DataChannelServer::Listen ( const URL url)
overridevirtual

Supports "ws" and "wss" schemes. "wss" scheme requires calling SetTLSCertificate before calling Listen.

Implements Urho3D::NetworkServer.

◆ SetIceServers()

void Urho3D::DataChannelServer::SetIceServers ( const StringVector &  servers)
inline

Configure ICE servers (STUN/TURN) to use for NAT traversal on all new connections. Format: "stun:server:port" or "turn:user:pass@server:port"

◆ SetIceTransportPolicy()

void Urho3D::DataChannelServer::SetIceTransportPolicy ( rtc::TransportPolicy  policy)
inline

Force TURN-relay-only mode for all new connections where direct connections are impossible. When enabled, all media traffic goes through the TURN server.

◆ SetIceUdpMux()

void Urho3D::DataChannelServer::SetIceUdpMux ( bool  enable)
inline

Multiplex all peer connections onto a single UDP port (libjuice only). The clean solution for dedicated servers — only one port to forward.

◆ SetPortRange()

void Urho3D::DataChannelServer::SetPortRange ( unsigned  begin,
unsigned  end 
)

Restrict WebRTC to a specific UDP port range for all new connections (default: 1024-65535). Useful for port-forwarded direct connections where predictable ports are needed.

◆ Stop()

void Urho3D::DataChannelServer::Stop ( )
overridevirtual

Stop listening and disconnect all clients.

Implements Urho3D::NetworkServer.


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