1#ifndef DITTO_PRESENCE_MANAGER_H
2#define DITTO_PRESENCE_MANAGER_H
5#include "ConnectionRequest.hpp"
6#include "DittoHandleWrapper.hpp"
7#include "PresenceGraph.hpp"
14using dittoffi_connection_request_t =
struct dittoffi_connection_request;
18struct OnConnectingWrapper;
20class DittoHandleWrapper;
27using PresenceObserverInternal = std::weak_ptr<PresenceCallback>;
28using PresenceObserver = std::shared_ptr<PresenceCallback>;
165 explicit Presence(std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper);
166 friend struct PresenceInternal;
175 std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper;
176 std::vector<PresenceObserverInternal> observers;
181 dittoffi_connection_request_t *ffi_connection_request);
A structure that holds the value and the strong reference count for an Arc.
Definition Arc.hpp:40
Represents the Ditto mesh network of peers and their connections between each other....
Definition PresenceGraph.hpp:211
void set_connection_request_handler(std::nullptr_t)
Unset the connection request handler, if one was previously set, replacing it with the default all-al...
void set_peer_metadata_json_string(std::string json_string)
Set arbitrary metadata formatted as JSON to be associated with the current peer.
void set_connection_request_handler(ConnectionRequestHandler connection_request_handler)
Set this handler to control which peers in a Ditto mesh can connect to the current peer.
nlohmann::json peer_metadata() const
Metadata associated with the current peer.
void set_peer_metadata(nlohmann::json const &peer_metadata)
Set arbitrary metadata to be associated with the current peer.
PresenceGraph exec()
Deprecated alias of graph()
PresenceObserver observe(PresenceCallback presence_cb)
This will run the provided callback when peers are updated.
std::string peer_metadata_json_string() const
Metadata associated with the current peer as a JSON string.
PresenceGraph graph()
Return an immediate representation of known peers.
Namespace for the Ditto C++ SDK types and functions.
Definition AbstractDocumentPath.hpp:19
std::function< void(PresenceGraph)> PresenceCallback
A type representing a callback that will get called when there are updates relating to presence.
Definition Presence.hpp:26
std::function< ConnectionRequestAuthorization(ConnectionRequest)> ConnectionRequestHandler
Definition ConnectionRequest.hpp:107