|
ORE Studio 0.0.4
|
Adapts remote server subscriptions to local notification callbacks. More...
#include <remote_event_adapter.hpp>

Public Member Functions | |
| remote_event_adapter (std::shared_ptr< net::client > client) | |
| Construct adapter with a client reference. | |
| ~remote_event_adapter () | |
| Destructor. | |
| boost::asio::awaitable< bool > | subscribe (const std::string &event_type) |
| Subscribe to notifications for an event type. | |
| boost::asio::awaitable< bool > | unsubscribe (const std::string &event_type) |
| Unsubscribe from notifications for an event type. | |
| bool | is_subscribed (const std::string &event_type) const |
| Check if currently subscribed to an event type. | |
| std::set< std::string > | get_subscriptions () const |
| Get the set of currently subscribed event types. | |
| boost::asio::awaitable< std::size_t > | resubscribe_all () |
| Re-subscribe to all previously subscribed event types. | |
| void | set_notification_callback (net::notification_callback_t callback) |
| Set callback to be invoked when notifications are received. | |
Adapts remote server subscriptions to local notification callbacks.
This class bridges the gap between client-side event handling and server-side subscription management. It:
Thread-safety: All operations are thread-safe.
|
explicit |
Construct adapter with a client reference.
The adapter registers itself as the notification callback on the client.
| client | The client to use for communication |
| ~remote_event_adapter | ( | ) |
Destructor.
Does not automatically unsubscribe from events.
| boost::asio::awaitable< bool > subscribe | ( | const std::string & | event_type | ) |
Subscribe to notifications for an event type.
Sends a SUBSCRIBE protocol message to the server. The subscription is tracked locally to support re-subscription after reconnect.
| event_type | The fully qualified event type name |

| boost::asio::awaitable< bool > unsubscribe | ( | const std::string & | event_type | ) |
Unsubscribe from notifications for an event type.
Sends an UNSUBSCRIBE protocol message to the server.
| event_type | The fully qualified event type name |
| bool is_subscribed | ( | const std::string & | event_type | ) | const |
Check if currently subscribed to an event type.
| event_type | The event type to check |
| std::set< std::string > get_subscriptions | ( | ) | const |
Get the set of currently subscribed event types.
| boost::asio::awaitable< std::size_t > resubscribe_all | ( | ) |
Re-subscribe to all previously subscribed event types.
Useful after reconnection to restore subscription state.
| void set_notification_callback | ( | net::notification_callback_t | callback | ) |
Set callback to be invoked when notifications are received.
| callback | Function to call with (event_type, timestamp) |