7 #ifndef ZEROEQ_SUBSCRIBER_H 8 #define ZEROEQ_SUBSCRIBER_H 10 #include <zeroeq/receiver.h> 11 #include <zeroeq/uri.h> 59 ZEROEQ_API
explicit Subscriber(
const std::string& session);
107 : Subscriber(
URIs{uri})
111 : Subscriber(
URIs{uri}, shared)
128 ZEROEQ_API
bool subscribe(servus::Serializable& serializable);
150 ZEROEQ_API
bool subscribe(
const uint128_t& event,
160 ZEROEQ_API
bool unsubscribe(
const servus::Serializable& serializable);
162 ZEROEQ_API
bool unsubscribe(
const uint128_t& event);
165 ZEROEQ_API
const std::string&
getSession()
const;
169 std::unique_ptr<Impl> _impl;
172 void addSockets(std::vector<detail::Socket>& entries)
final;
173 bool process(detail::Socket& socket)
final;
175 void addConnection(
const std::string& uri)
final;
Enhances servus::URI to guarantee the existance of a schema and to allow construction of [host][:port...
Subscribes to Publisher to receive events.
bool unsubscribe(const servus::Serializable &serializable)
Unsubscribe a serializable object to stop applying updates from any connected publisher.
const std::string & getSession() const
Subscriber()
Create a default subscriber.
~Subscriber()
Destroy this subscriber and withdraw any subscriptions.
bool subscribe(servus::Serializable &serializable)
Subscribe a serializable object to receive updates from any connected publisher.
std::function< void()> EventFunc
Callback for receival of subscribed event without payload.
std::vector< URI > URIs
A vector of URIs.
std::function< void(const void *, size_t)> EventPayloadFunc
Callback for receival of subscribed event with payload.
Base class for entities receiving data.
Subscriber(const URI &uri, Receiver &shared)
Publish-subscribe and request-reply.
Subscriber(const URI &uri)