|
ORE Studio 0.0.4
|
Represents a client session on the server side. More...
#include <server_session.hpp>

Classes | |
| struct | pending_database_status |
| Pending database status notification to be sent to client. More... | |
| struct | pending_notification |
| Pending notification to be sent to client. More... | |
Public Member Functions | |
| server_session (std::unique_ptr< connection > conn, std::string server_id, std::shared_ptr< messaging::message_dispatcher > dispatcher, boost::asio::any_io_executor io_executor, std::shared_ptr< service::subscription_manager > subscription_mgr=nullptr) | |
| Construct a session from a connection. | |
| boost::asio::awaitable< void > | run () |
| Run the session. | |
| void | stop () |
| Stop the session by closing its connection. | |
| bool | queue_notification (const std::string &event_type, std::chrono::system_clock::time_point timestamp) |
| Queue a notification to be sent to this session's client. | |
| bool | queue_database_status (bool available, const std::string &error_message, std::chrono::system_clock::time_point timestamp) |
| Queue a database status notification to be sent to this client. | |
Represents a client session on the server side.
Manages the lifecycle of a single client connection, including handshake, message processing, and cleanup.
|
explicit |
Construct a session from a connection.
| conn | The connection to manage |
| server_id | Server identifier for handshake |
| dispatcher | Message dispatcher for handling requests |
| io_executor | The executor to use for async operations |
| subscription_mgr | Optional subscription manager for event notifications |
| boost::asio::awaitable< void > run | ( | ) |
Run the session.
Performs handshake and processes messages until connection closes.
| void stop | ( | ) |
Stop the session by closing its connection.
This will cause any pending I/O operations to fail and the session to end.
| bool queue_notification | ( | const std::string & | event_type, |
| std::chrono::system_clock::time_point | timestamp | ||
| ) |
Queue a notification to be sent to this session's client.
Thread-safe. The notification will be sent on the next iteration of the message processing loop.
| event_type | The event type that occurred. |
| timestamp | The timestamp of the event. |
| bool queue_database_status | ( | bool | available, |
| const std::string & | error_message, | ||
| std::chrono::system_clock::time_point | timestamp | ||
| ) |
Queue a database status notification to be sent to this client.
Thread-safe. Used to inform the client of database availability status.
| available | Whether the database is available. |
| error_message | Error message if unavailable, empty otherwise. |
| timestamp | The timestamp of the status check. |