![]() |
ImFusion C++ SDK 4.4.0
|
#include <ImFusion/Stream/Network/ServerConnectionBase.h>
Abstract base class providing a server interface. More...
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 ImFusion::Network::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 ImFusion::Network::TypedConnectionBase< Payload > | |
| ProtectedSignal< std::shared_ptr< const Payload > > | signalNewMessage |
| Signal emitted when a new message is received. | |
| ProtectedSignal< std::shared_ptr< const Payload > > | signalMessageSent |
| Signal emitted when a message is sent. | |
|
pure virtual |
Starts listening for incoming connections.
Implemented in ImFusion::Network::TCPSocketServer< Payload >, ImFusion::Network::WebsocketServer< Payload >, ImFusion::Network::WebsocketServer< ImFusion::ByteBuffer >, and ImFusion::Network::WebsocketServer< std::string >.
|
pure virtual |
Stops listening and terminates all open connections.
Implemented in ImFusion::Network::TCPSocketServer< Payload >, ImFusion::Network::WebsocketServer< Payload >, ImFusion::Network::WebsocketServer< ImFusion::ByteBuffer >, and ImFusion::Network::WebsocketServer< std::string >.
|
pure virtual |
Returns true if the server is actively listening for incoming connections.
Implemented in ImFusion::Network::TCPSocketServer< Payload >, ImFusion::Network::WebsocketServer< Payload >, ImFusion::Network::WebsocketServer< ImFusion::ByteBuffer >, and ImFusion::Network::WebsocketServer< std::string >.
|
pure virtual |
Returns the number of currently connected clients.
Implemented in ImFusion::Network::TCPSocketServer< Payload >, ImFusion::Network::WebsocketServer< Payload >, ImFusion::Network::WebsocketServer< ImFusion::ByteBuffer >, and ImFusion::Network::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 ImFusion::Network::TCPSocketServer< Payload >, ImFusion::Network::WebsocketServer< Payload >, ImFusion::Network::WebsocketServer< ImFusion::ByteBuffer >, and ImFusion::Network::WebsocketServer< std::string >.