ORE Studio 0.0.4
Loading...
Searching...
No Matches
Public Member Functions | List of all members
server Class Referencefinal

ORES protocol server. More...

#include <server.hpp>

Inherits enable_shared_from_this< server >.

Collaboration diagram for server:
Collaboration graph

Public Member Functions

 server (server_options options, std::shared_ptr< service::subscription_manager > subscription_mgr=nullptr)
 Construct server with configuration.
 
void register_handler (messaging::message_type_range range, std::shared_ptr< messaging::message_handler > handler)
 Register a message handler for a range of message types.
 
std::shared_ptr< service::auth_session_servicesessions () const
 Get the shared auth session service.
 
boost::asio::awaitable< void > run (boost::asio::io_context &io_context, std::function< void(std::uint16_t)> on_listening=nullptr)
 Run the server.
 
void stop ()
 Stop the server.
 
void broadcast_database_status (bool available, const std::string &error_message)
 Broadcast database status to all connected clients.
 

Detailed Description

ORES protocol server.

Accepts SSL connections, performs handshake, and manages client sessions.

Constructor & Destructor Documentation

◆ server()

server ( server_options  options,
std::shared_ptr< service::subscription_manager subscription_mgr = nullptr 
)
explicit

Construct server with configuration.

Parameters
optionsServer options including port, SSL config, etc.
subscription_mgrOptional subscription manager for event notifications.

Member Function Documentation

◆ register_handler()

void register_handler ( messaging::message_type_range  range,
std::shared_ptr< messaging::message_handler handler 
)

Register a message handler for a range of message types.

Must be called before run() to register subsystem handlers.

◆ sessions()

std::shared_ptr< service::auth_session_service > sessions ( ) const

Get the shared auth session service.

Use this to pass the auth session service to handlers that need it (e.g., accounts_message_handler for login/logout management).

◆ run()

boost::asio::awaitable< void > run ( boost::asio::io_context &  io_context,
std::function< void(std::uint16_t)>  on_listening = nullptr 
)

Run the server.

Accepts connections and spawns sessions until stopped.

Parameters
io_contextThe io_context to run the server on
on_listeningOptional callback invoked when server starts listening

◆ stop()

void stop ( )

Stop the server.

Stops all active sessions and the accept loop.

◆ broadcast_database_status()

void broadcast_database_status ( bool  available,
const std::string &  error_message 
)

Broadcast database status to all connected clients.

Sends a database_status_notification to all active sessions, regardless of their subscription status.

Parameters
availableWhether the database is available.
error_messageError message if unavailable, empty otherwise.