![]() |
ImFusion SDK 4.3
|
#include <ImFusion/Stream/Network/ServerConnectionBase.h>
Abstract base class providing a server interface. More...
Inheritance diagram for 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. | |
|
pure virtual |
Starts listening for incoming connections.
Implemented in TCPSocketServer< Payload >, WebsocketServer< Payload >, WebsocketServer< ImFusion::ByteBuffer >, and WebsocketServer< std::string >.
|
pure virtual |
Stops listening and terminates all open connections.
Implemented in TCPSocketServer< Payload >, WebsocketServer< Payload >, WebsocketServer< ImFusion::ByteBuffer >, and WebsocketServer< std::string >.
|
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 >.
|
pure virtual |
Returns the number of currently connected clients.
Implemented in TCPSocketServer< Payload >, WebsocketServer< Payload >, WebsocketServer< ImFusion::ByteBuffer >, and WebsocketServer< std::string >.
|
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 >.