1#ifndef _DITTO_PRESENCE_MANAGER_
2#define _DITTO_PRESENCE_MANAGER_
5#include "ConnectionRequest.hpp"
6#include "DittoHandleWrapper.hpp"
7#include "PresenceGraph.hpp"
14typedef struct dittoffi_connection_request dittoffi_connection_request_t;
18struct OnConnectingWrapper;
20class DittoHandleWrapper;
26typedef std::function<void(PresenceGraph)> PresenceCallback;
28typedef std::weak_ptr<PresenceCallback> PresenceObserverInternal;
29typedef std::shared_ptr<PresenceCallback> PresenceObserver;
170 Presence(std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper);
180 std::shared_ptr<DittoHandleWrapper> ditto_handle_wrapper;
181 std::vector<PresenceObserverInternal> observers;
186 dittoffi_connection_request_t *ffi_connection_request);
The entrypoint to the Ditto SDK.
Definition Ditto.hpp:32
Represents the Ditto mesh network of peers and their connections between each other....
Definition PresenceGraph.hpp:141
Definition Presence.hpp:34
void set_peer_metadata_json_string(std::string json_string)
Set arbitrary metadata formatted as JSON to be associated with the current peer.
Definition Presence.cpp:114
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.
Definition Presence.cpp:181
nlohmann::json peer_metadata() const
Metadata associated with the current peer.
Definition Presence.cpp:110
void set_peer_metadata(nlohmann::json const &peer_metadata)
Set arbitrary metadata to be associated with the current peer.
Definition Presence.cpp:141
DITTO_DEPRECATED PresenceGraph exec()
Deprecated alias of graph()
Definition Presence.cpp:92
PresenceObserver observe(PresenceCallback presence_cb)
This will run the provided callback when peers are updated.
Definition Presence.cpp:72
std::string peer_metadata_json_string() const
Metadata associated with the current peer as a JSON string.
Definition Presence.cpp:102
PresenceGraph graph()
Return an immediate representation of known peers.
Definition Presence.cpp:94
basic_json<> json
default JSON class
Definition json.hpp:2933
Privacy hack.
Definition Presence.cpp:50