Event Handling Interface

#include <dolbyio/comms/event_handling.h>

The event handler connection interface is used for handling subscriptions to events which can be emitted by the SDK. The user will utilize either sdk::add_event_handler or conference::add_event_handler to subscribe to an events.

  • In order to subscribe to an event the user will provide a callback of type event_handler to be invoked by the SDK when th event occurrs.

  • The user will receive a event_handler_connection for each event they subscribe to. This connection is to be used to disconnect a event listener.

  • When subscription is finished the user will be returned an event_handler_id which is a unique pointer to an event_handler_connection.

template<typename ...EventTypes>
using dolbyio::comms::event_handler = std::function<void(const EventTypes&...)>

The function object that handles subscribing to events and returns a void operator.

Template Parameters:

EventType – The selected event.

using dolbyio::comms::event_handler_id = std::unique_ptr<event_handler_connection>

Defines a type of the unique pointer to dolbyio::comms::event_handler_connection.

class event_handler_connection

The interface that exposes a connection to the handler. The interface is created for each subscribed event.

Public Functions

virtual ~event_handler_connection()

The destructor of the handler connection that does not disconnect the handler.

virtual async_result<void> disconnect() = 0

Disconnects a handler to unsubscribe from the subscribed event.

// Wait for the operation to complete

// Continue in the `then` call
  .then([]() {
    // the handler is disconnected
  .on_error([](auto&& e) {
    // handle the disconnect error

This function is asynchronous and the operation is executed on the event loop of the SDK. You can either block the calling thread until the operation completes or chain consecutive operations that depend on the completion of this method using the async_result::then call. The async_result chain operations need to be terminated with an async_result::on_error.


The result object producing the operation status asynchronously.