Web socket implementation. This class is the base class of the web socket session, it will handle the read and write operations.
More...
|
|
| WsBase (std::string ip, std::reference_wrapper< util::TagDecoratorFactory const > tagFactory, std::reference_wrapper< dosguard::DOSGuardInterface > dosGuard, std::shared_ptr< HandlerType > const &handler, boost::beast::flat_buffer &&buffer, std::uint32_t maxSendingQueueSize) |
|
Derived< HandlerType > & | derived () |
|
void | doWrite () |
|
void | onWrite (boost::system::error_code ec, std::size_t) |
|
void | maybeSendNext () |
| void | sendSlowDown (std::string const &request) override |
| | Send a "slow down" error response to the client.
|
| void | send (std::shared_ptr< std::string > msg) override |
| | Send a message to the client.
|
| SubscriptionContextPtr | makeSubscriptionContext (util::TagDecoratorFactory const &factory) override |
| | Get the subscription context for this connection.
|
| void | send (std::string &&msg, http::status) override |
| | Send a message to the client.
|
|
void | run (http::request< http::string_body > req) |
| | Accept the session asynchronously.
|
|
void | onAccept (boost::beast::error_code ec) |
|
void | doRead () |
|
void | onRead (boost::beast::error_code ec, std::size_t bytesTransferred) |
| | ConnectionBase (util::TagDecoratorFactory const &tagFactory, std::string ip) |
| | Create a new connection base.
|
| bool | dead () |
| | Indicates whether the connection had an error and is considered dead.
|
| bool | isAdmin () const |
| | Indicates whether the connection has admin privileges.
|
| std::string const & | clientIp () const |
| | Get the IP address of the client.
|
|
| Taggable (Taggable &&)=default |
|
Taggable & | operator= (Taggable &&)=default |
| BaseTagDecorator const & | tag () const |
| | Getter for tag decorator.
|
template<template< typename > typename Derived, SomeServerHandler HandlerType>
class web::impl::WsBase< Derived, HandlerType >
Web socket implementation. This class is the base class of the web socket session, it will handle the read and write operations.
The write operation is via a queue, each write operation of this session will be sent in order. The write operation also supports shared_ptr of string, so the caller can keep the string alive until it is sent. It is useful when we have multiple sessions sending the same content.
- Template Parameters
-
| Derived | The derived class |
| HandlerType | The handler type, will be called when a request is received. |