22#include "util/CoroutineGroup.hpp"
23#include "util/Taggable.hpp"
24#include "web/SubscriptionContextInterface.hpp"
25#include "web/ng/Connection.hpp"
26#include "web/ng/Error.hpp"
27#include "web/ng/impl/WsConnection.hpp"
29#include <boost/asio/any_io_executor.hpp>
30#include <boost/asio/spawn.hpp>
31#include <boost/signals2/variadic_signal.hpp>
56 std::reference_wrapper<impl::WsConnectionBase> connection_;
57 std::optional<size_t> maxSendQueueSize_;
59 boost::asio::yield_context yield_;
63 std::atomic_bool disconnected_{
false};
70 std::atomic_uint32_t apiSubversion_ = 0u;
85 std::optional<size_t> maxSendQueueSize,
86 boost::asio::yield_context yield,
97 send(std::shared_ptr<std::string> message)
override;
CoroutineGroup is a helper class to manage a group of coroutines. It allows to spawn multiple corouti...
Definition CoroutineGroup.hpp:37
A factory for TagDecorator instantiation.
Definition Taggable.hpp:169
An interface to provide connection functionality for subscriptions.
Definition SubscriptionContextInterface.hpp:39
std::function< void(SubscriptionContextInterface *)> OnDisconnectSlot
Alias for on disconnect slot.
Definition SubscriptionContextInterface.hpp:57
A class representing a connection to a client.
Definition Connection.hpp:100
Implementation of SubscriptionContextInterface.
Definition SubscriptionContext.hpp:48
std::function< bool(Error const &, Connection const &)> ErrorHandler
Error handler definition. Error handler returns true if connection should be closed false otherwise.
Definition SubscriptionContext.hpp:53
void onDisconnect(OnDisconnectSlot const &slot) override
Connect a slot to onDisconnect connection signal.
Definition SubscriptionContext.cpp:75
void send(std::shared_ptr< std::string > message) override
Send message to the client.
Definition SubscriptionContext.cpp:54
void setApiSubversion(uint32_t value) override
Set the API subversion.
Definition SubscriptionContext.cpp:81
SubscriptionContext(util::TagDecoratorFactory const &factory, impl::WsConnectionBase &connection, std::optional< size_t > maxSendQueueSize, boost::asio::yield_context yield, ErrorHandler errorHandler)
Construct a new Subscription Context object.
Definition SubscriptionContext.cpp:37
uint32_t apiSubversion() const override
Get the API subversion.
Definition SubscriptionContext.cpp:87
void disconnect(boost::asio::yield_context yield)
Notify the context that related connection is disconnected and wait for all the task to complete.
Definition SubscriptionContext.cpp:93
Definition WsConnection.hpp:55