Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
web::ConnectionBase Struct Referenceabstract

Base class for all connections. More...

#include <ConnectionBase.hpp>

Inheritance diagram for web::ConnectionBase:
Collaboration diagram for web::ConnectionBase:

Public Member Functions

 ConnectionBase (util::TagDecoratorFactory const &tagFactory, std::string ip)
 Create a new connection base.
 
virtual void send (std::string &&msg, http::status status=http::status::ok)=0
 Send the response to the client.
 
virtual void send (std::shared_ptr< std::string > msg)
 Send via shared_ptr of string, that enables SubscriptionManager to publish to clients.
 
virtual SubscriptionContextPtr makeSubscriptionContext (util::TagDecoratorFactory const &factory)=0
 Get the subscription context for this connection.
 
bool dead ()
 Indicates whether the connection had an error and is considered dead.
 
bool isAdmin () const
 Indicates whether the connection has admin privileges.
 
- Public Member Functions inherited from util::Taggable
 Taggable (Taggable &&)=default
 
Taggableoperator= (Taggable &&)=default
 
BaseTagDecorator const & tag () const
 Getter for tag decorator.
 

Public Attributes

std::string const clientIp
 
bool upgraded = false
 

Protected Attributes

boost::system::error_code ec_
 
bool isAdmin_ = false
 

Additional Inherited Members

- Protected Member Functions inherited from util::Taggable
 Taggable (util::TagDecoratorFactory const &tagFactory)
 New Taggable from a specified factory.
 

Detailed Description

Base class for all connections.

This class is used to represent a connection in RPC executor and subscription manager.

Constructor & Destructor Documentation

◆ ConnectionBase()

web::ConnectionBase::ConnectionBase ( util::TagDecoratorFactory const & tagFactory,
std::string ip )
inline

Create a new connection base.

Parameters
tagFactoryThe factory that generates tags to track sessions and requests
ipThe IP address of the connected peer

Member Function Documentation

◆ dead()

bool web::ConnectionBase::dead ( )
inline

Indicates whether the connection had an error and is considered dead.

Returns
true if the connection is considered dead; false otherwise

◆ isAdmin()

bool web::ConnectionBase::isAdmin ( ) const
inlinenodiscard

Indicates whether the connection has admin privileges.

Returns
true if the connection is from admin user

◆ makeSubscriptionContext()

virtual SubscriptionContextPtr web::ConnectionBase::makeSubscriptionContext ( util::TagDecoratorFactory const & factory)
pure virtual

Get the subscription context for this connection.

Parameters
factoryTag TagDecoratorFactory to use to create the context.
Returns
The subscription context for this connection.

Implemented in web::impl::HttpBase< Derived, HandlerType >, web::impl::HttpBase< HttpSession, HandlerType >, web::impl::HttpBase< SslHttpSession, HandlerType >, web::impl::WsBase< Derived, HandlerType >, web::impl::WsBase< PlainWsSession, HandlerType >, and web::impl::WsBase< SslWsSession, HandlerType >.

◆ send() [1/2]

virtual void web::ConnectionBase::send ( std::shared_ptr< std::string > msg)
inlinevirtual

Send via shared_ptr of string, that enables SubscriptionManager to publish to clients.

Parameters
msgUnused
Exceptions
std::logic_errorunless the function is overridden by a child class.

Reimplemented in web::impl::WsBase< Derived, HandlerType >, web::impl::WsBase< PlainWsSession, HandlerType >, and web::impl::WsBase< SslWsSession, HandlerType >.

◆ send() [2/2]

virtual void web::ConnectionBase::send ( std::string && msg,
http::status status = http::status::ok )
pure virtual

The documentation for this struct was generated from the following file: