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

Adapts remote server subscriptions to local notification callbacks. More...

#include <remote_event_adapter.hpp>

Collaboration diagram for remote_event_adapter:
Collaboration graph

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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ remote_event_adapter()

remote_event_adapter ( std::shared_ptr< net::client client)
explicit

Construct adapter with a client reference.

The adapter registers itself as the notification callback on the client.

Parameters
clientThe client to use for communication

◆ ~remote_event_adapter()

Destructor.

Does not automatically unsubscribe from events.

Member Function Documentation

◆ subscribe()

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.

Parameters
event_typeThe fully qualified event type name
Returns
True if subscription succeeded, false otherwise
Here is the caller graph for this function:

◆ unsubscribe()

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.

Parameters
event_typeThe fully qualified event type name
Returns
True if unsubscription succeeded, false otherwise

◆ is_subscribed()

bool is_subscribed ( const std::string &  event_type) const

Check if currently subscribed to an event type.

Parameters
event_typeThe event type to check
Returns
True if subscribed, false otherwise

◆ get_subscriptions()

std::set< std::string > get_subscriptions ( ) const

Get the set of currently subscribed event types.

Returns
Set of event type names

◆ resubscribe_all()

boost::asio::awaitable< std::size_t > resubscribe_all ( )

Re-subscribe to all previously subscribed event types.

Useful after reconnection to restore subscription state.

Returns
Number of successful re-subscriptions

◆ set_notification_callback()

void set_notification_callback ( net::notification_callback_t  callback)

Set callback to be invoked when notifications are received.

Parameters
callbackFunction to call with (event_type, timestamp)