|
ORE Studio 0.0.4
|
ORES protocol client. More...
#include <client.hpp>

Public Member Functions | |
| client (client_options config, std::shared_ptr< eventing::service::event_bus > event_bus=nullptr) | |
| Construct client with configuration. | |
| client (client_options config, boost::asio::any_io_executor executor, std::shared_ptr< eventing::service::event_bus > event_bus=nullptr) | |
| Construct client with configuration and executor. | |
| ~client () | |
| Destructor. | |
| boost::asio::awaitable< void > | connect () |
| Connect to server and perform handshake (async version). | |
| void | connect_sync () |
| Connect to server and perform handshake (blocking version). | |
| boost::asio::awaitable< void > | connect_with_retry () |
| Connect to server with retry (async version). | |
| void | connect_with_retry_sync () |
| Connect to server with retry (blocking version). | |
| void | disconnect () |
| Disconnect from server. | |
| bool | await_shutdown (std::chrono::milliseconds timeout=std::chrono::milliseconds{5000}) |
| Wait for all coroutines to complete after disconnect. | |
| bool | is_connected () const |
| Check if client is connected. | |
| connection_state | get_state () const |
| Get the current connection state. | |
| void | set_disconnect_callback (disconnect_callback_t callback) |
| Set callback to be invoked when disconnect is detected. | |
| void | set_reconnecting_callback (reconnecting_callback_t callback) |
| Set callback to be invoked when reconnection starts. | |
| void | set_reconnected_callback (reconnected_callback_t callback) |
| Set callback to be invoked when reconnection succeeds. | |
| void | set_notification_callback (notification_callback_t callback) |
| Set callback to be invoked when a notification is received. | |
| std::expected< std::filesystem::path, recording::session_file_error > | enable_recording (const std::filesystem::path &output_directory) |
| Enable session recording to the specified directory. | |
| void | disable_recording () |
| Disable session recording. | |
| bool | is_recording () const |
| Check if session recording is currently active. | |
| boost::asio::awaitable< std::expected< messaging::frame, ores::utility::serialization::error_code > > | send_request (messaging::frame request_frame) |
| Send a request frame and receive response frame (async version). | |
| std::expected< messaging::frame, ores::utility::serialization::error_code > | send_request_sync (messaging::frame request_frame) |
| Send a request frame and receive response frame (blocking version). | |
| template<typename RequestType , typename ResponseType , messaging::message_type RequestMsgType> | |
| std::expected< ResponseType, ores::utility::serialization::error_code > | process_request (RequestType request) |
| Send typed request and receive typed response (blocking version). | |
| template<typename RequestType , typename ResponseType , messaging::message_type RequestMsgType> | |
| boost::asio::awaitable< std::expected< ResponseType, ores::utility::serialization::error_code > > | process_request_async (RequestType request) |
| Send typed request and receive typed response (async version). | |
| template<typename RequestType > requires messaging::has_message_traits<RequestType> | |
| std::expected< typename messaging::message_traits< RequestType >::response_type, ores::utility::serialization::error_code > | process_request (RequestType request) |
| Send typed request using message_traits (blocking version). | |
| template<typename RequestType > requires messaging::has_message_traits<RequestType> | |
| boost::asio::awaitable< std::expected< typename messaging::message_traits< RequestType >::response_type, ores::utility::serialization::error_code > > | process_request_async (RequestType request) |
| Send typed request using message_traits (async version). | |
ORES protocol client.
Connects to server via SSL, performs handshake, and manages communication.
|
explicit |
Construct client with configuration.
Creates its own io_context for synchronous operations.
| config | Client configuration options |
| event_bus | Optional event bus for publishing connection events |
|
explicit |
Construct client with configuration and executor.
| config | Client configuration options |
| executor | The executor to use for async operations |
| event_bus | Optional event bus for publishing connection events |
| ~client | ( | ) |
Destructor.
Ensures proper cleanup order - strand and pending requests must be destroyed before the io_context they reference.
| boost::asio::awaitable< void > connect | ( | ) |
Connect to server and perform handshake (async version).
Single attempt connection without retries.
| connection_error | if connection or handshake fails |

| void connect_sync | ( | ) |
Connect to server and perform handshake (blocking version).
Single attempt connection without retries.
| connection_error | if connection or handshake fails |
| boost::asio::awaitable< void > connect_with_retry | ( | ) |
Connect to server with retry (async version).
Attempts connection with exponential backoff according to retry_options.
| connection_error | if all retry attempts fail |

| void connect_with_retry_sync | ( | ) |
Connect to server with retry (blocking version).
Attempts connection with exponential backoff according to retry_options.
| connection_error | if all retry attempts fail |
| void disconnect | ( | ) |
Disconnect from server.
Signals all running coroutines to stop and closes the connection. Does not wait for coroutines to complete - call await_shutdown() after disconnect() to wait for safe cleanup.

| bool await_shutdown | ( | std::chrono::milliseconds | timeout = std::chrono::milliseconds{5000} | ) |
Wait for all coroutines to complete after disconnect.
Blocks until message loop, reconnect loop, and heartbeat loop have all exited. Must be called after disconnect() before destroying the client to avoid use-after-free crashes.
| timeout | Maximum time to wait (default 5 seconds) |
| bool is_connected | ( | ) | const |
Check if client is connected.
Returns true only when in the connected state, not during reconnection.
| void set_disconnect_callback | ( | disconnect_callback_t | callback | ) |
Set callback to be invoked when disconnect is detected.
The callback will be called from the heartbeat coroutine when a ping fails or times out. It should be thread-safe.
| callback | Function to call on disconnect (may be empty to disable) |
| void set_reconnecting_callback | ( | reconnecting_callback_t | callback | ) |
Set callback to be invoked when reconnection starts.
The callback will be called when auto-reconnect begins after connection loss. It should be thread-safe.
| callback | Function to call on reconnection start (may be empty to disable) |
| void set_reconnected_callback | ( | reconnected_callback_t | callback | ) |
Set callback to be invoked when reconnection succeeds.
The callback will be called after auto-reconnect successfully restores the connection. It should be thread-safe.
| callback | Function to call on reconnection success (may be empty to disable) |
| void set_notification_callback | ( | notification_callback_t | callback | ) |
Set callback to be invoked when a notification is received.
The callback will be called when the server pushes a notification for an event type the client is subscribed to. It should be thread-safe.
| callback | Function to call on notification (may be empty to disable) |
| std::expected< std::filesystem::path, recording::session_file_error > enable_recording | ( | const std::filesystem::path & | output_directory | ) |
Enable session recording to the specified directory.
Creates a new session recording file in the specified directory. The file will contain all frames sent and received during the session. Recording can be started before or after connecting.
| output_directory | Directory where the session file will be created |
| void disable_recording | ( | ) |
Disable session recording.
Stops recording and closes the session file. Safe to call when not recording or already disabled.
| boost::asio::awaitable< std::expected< messaging::frame, ores::utility::serialization::error_code > > send_request | ( | messaging::frame | request_frame | ) |
Send a request frame and receive response frame (async version).
Generic method for sending any request and receiving response. Manages sequence numbers automatically.
| request_frame | The request frame to send |

| std::expected< messaging::frame, ores::utility::serialization::error_code > send_request_sync | ( | messaging::frame | request_frame | ) |
Send a request frame and receive response frame (blocking version).
Generic method for sending any request and receiving response. Manages sequence numbers automatically.
| request_frame | The request frame to send |

| std::expected< ResponseType, ores::utility::serialization::error_code > process_request | ( | RequestType | request | ) |
Send typed request and receive typed response (blocking version).
Handles serialization, framing, decompression, and deserialization.
| RequestType | Request message type (must have serialize() method) |
| ResponseType | Response message type (must have static deserialize() method) |
| RequestMsgType | The message_type enum value for this request |
| request | The request to send |

| boost::asio::awaitable< std::expected< ResponseType, ores::utility::serialization::error_code > > process_request_async | ( | RequestType | request | ) |
Send typed request and receive typed response (async version).
Handles serialization, framing, decompression, and deserialization.
| RequestType | Request message type (must have serialize() method) |
| ResponseType | Response message type (must have static deserialize() method) |
| RequestMsgType | The message_type enum value for this request |
| request | The request to send |

| std::expected< typename messaging::message_traits< RequestType >::response_type, ores::utility::serialization::error_code > process_request | ( | RequestType | request | ) |
Send typed request using message_traits (blocking version).
Uses message_traits to automatically determine the response type and message_type enum value from the request type.
| RequestType | Request message type (must have message_traits) |
| request | The request to send |
| boost::asio::awaitable< std::expected< typename messaging::message_traits< RequestType >::response_type, ores::utility::serialization::error_code > > process_request_async | ( | RequestType | request | ) |
Send typed request using message_traits (async version).
Uses message_traits to automatically determine the response type and message_type enum value from the request type.
| RequestType | Request message type (must have message_traits) |
| request | The request to send |