ImFusion SDK 4.3
ServerConnectionBase< Payload > Class Template Referenceabstract

#include <ImFusion/Stream/Network/ServerConnectionBase.h>

Abstract base class providing a server interface. More...

+ Inheritance diagram for ServerConnectionBase< Payload >:

Detailed Description

template<typename Payload>
class ImFusion::Network::ServerConnectionBase< Payload >

Abstract base class providing a server interface.

This class implements functionality specific to servers, including listening for incoming connection requests and managing multiple client connections.

Implemented by WebsocketServer and TCPServer.

This class should only be used directly for implementing a custom server that will be registered with the ConnectionFactory.

Public Member Functions

virtual bool run ()=0
 Starts listening for incoming connections.
 
virtual bool stop ()=0
 Stops listening and terminates all open connections.
 
virtual bool isRunning () const =0
 Returns true if the server is actively listening for incoming connections.
 
virtual size_t connectedClients () const =0
 Returns the number of currently connected clients.
 
virtual std::string address () const =0
 Returns the address of the server in the form {ip}:{port} (e.g., 127.0.0.1:5678).
 
- Public Member Functions inherited from TypedConnectionBase< Payload >
virtual void sendMessage (Payload message)=0
 Sends a message over the network connection.
 

Public Attributes

ProtectedSignal< bool > signalClientConnected
 Signal emitted when a new client connects (true) or when a client disconnects (false)
 
- Public Attributes inherited from TypedConnectionBase< Payload >
ProtectedSignal< std::shared_ptr< Payload > > signalNewMessage
 Signal emitted when a new message is received.
 
ProtectedSignal< std::shared_ptr< Payload > > signalMessageSent
 Signal emitted when a message is sent.
 

Member Function Documentation

◆ run()

template<typename Payload>
virtual bool run ( )
pure virtual

◆ stop()

template<typename Payload>
virtual bool stop ( )
pure virtual

Stops listening and terminates all open connections.

Implemented in TCPSocketServer< Payload >, WebsocketServer< Payload >, WebsocketServer< ImFusion::ByteBuffer >, and WebsocketServer< std::string >.

◆ isRunning()

template<typename Payload>
virtual bool isRunning ( ) const
pure virtual

Returns true if the server is actively listening for incoming connections.

Implemented in TCPSocketServer< Payload >, WebsocketServer< Payload >, WebsocketServer< ImFusion::ByteBuffer >, and WebsocketServer< std::string >.

◆ connectedClients()

template<typename Payload>
virtual size_t connectedClients ( ) const
pure virtual

◆ address()

template<typename Payload>
virtual std::string address ( ) const
pure virtual

Returns the address of the server in the form {ip}:{port} (e.g., 127.0.0.1:5678).

Implemented in TCPSocketServer< Payload >, WebsocketServer< Payload >, WebsocketServer< ImFusion::ByteBuffer >, and WebsocketServer< std::string >.


The documentation for this class was generated from the following file:
Search Tab / S to search, Esc to close