3#include "util/Taggable.hpp"
4#include "web/SubscriptionContextInterface.hpp"
6#include <boost/beast/http.hpp>
7#include <boost/beast/http/status.hpp>
8#include <boost/signals2.hpp>
9#include <boost/signals2/variadic_signal.hpp>
18namespace http = boost::beast::http;
27 boost::system::error_code ec_;
28 bool isAdmin_ =
false;
29 std::string clientIp_;
32 bool upgraded =
false;
41 :
Taggable(tagFactory), clientIp_(std::move(ip))
52 send(std::string&& msg, http::status status = http::status::ok) = 0;
61 send([[maybe_unused]] std::shared_ptr<std::string> msg)
63 throw std::logic_error(
"web server can not send the shared payload");
90 return ec_ != boost::system::error_code{};
109 [[nodiscard]] std::string
const&
A factory for TagDecorator instantiation.
Definition Taggable.hpp:165
A base class that allows attaching a tag decorator to a subclass.
Definition Taggable.hpp:236
Taggable(util::TagDecoratorFactory const &tagFactory)
New Taggable from a specified factory.
Definition Taggable.hpp:246
This namespace implements the web server and related components.
Definition Types.hpp:24
std::shared_ptr< SubscriptionContextInterface > SubscriptionContextPtr
An alias for shared pointer to a SubscriptionContextInterface.
Definition SubscriptionContextInterface.hpp:64
virtual SubscriptionContextPtr makeSubscriptionContext(util::TagDecoratorFactory const &factory)=0
Get the subscription context for this connection.
virtual void send(std::shared_ptr< std::string > msg)
Send via shared_ptr of string, that enables SubscriptionManager to publish to clients.
Definition ConnectionBase.hpp:61
std::string const & clientIp() const
Get the IP address of the client.
Definition ConnectionBase.hpp:110
ConnectionBase(util::TagDecoratorFactory const &tagFactory, std::string ip)
Create a new connection base.
Definition ConnectionBase.hpp:40
bool isAdmin() const
Indicates whether the connection has admin privileges.
Definition ConnectionBase.hpp:99
virtual void send(std::string &&msg, http::status status=http::status::ok)=0
Send the response to the client.
bool dead()
Indicates whether the connection had an error and is considered dead.
Definition ConnectionBase.hpp:88
virtual void sendSlowDown(std::string const &request)=0
Send a "slow down" error response to the client.