Clio develop
The XRP Ledger API server.
|
A class representing a connection to a client. More...
#include <Connection.hpp>
Public Member Functions | |
Connection (std::string ip, boost::beast::flat_buffer buffer, util::TagDecoratorFactory const &tagDecoratorFactory) | |
Construct a new Connection object. | |
virtual void | setTimeout (std::chrono::steady_clock::duration newTimeout)=0 |
Get the timeout for send, receive, and close operations. For WebSocket connections, this is the ping interval. | |
virtual std::optional< Error > | send (Response response, boost::asio::yield_context yield)=0 |
Send a response to the client. | |
virtual std::expected< Request, Error > | receive (boost::asio::yield_context yield)=0 |
Receive a request from the client. | |
virtual void | close (boost::asio::yield_context yield)=0 |
Gracefully close the connection. | |
![]() | |
ConnectionMetadata (std::string ip, util::TagDecoratorFactory const &tagDecoratorFactory) | |
Construct a new ConnectionMetadata object. | |
virtual bool | wasUpgraded () const =0 |
Whether the connection was upgraded. Upgraded connections are websocket connections. | |
std::string const & | ip () const |
Get the ip of the client. | |
bool | isAdmin () const |
Get whether the client is an admin. | |
template<std::invocable T> | |
void | setIsAdmin (T &&setter) |
Set the isAdmin field. | |
![]() | |
Taggable (Taggable &&)=default | |
Taggable & | operator= (Taggable &&)=default |
BaseTagDecorator const & | tag () const |
Getter for tag decorator. | |
Static Public Attributes | |
static constexpr std::chrono::steady_clock::duration | kDEFAULT_TIMEOUT = std::chrono::seconds{11} |
The default timeout for send, receive, and close operations. | |
Protected Attributes | |
boost::beast::flat_buffer | buffer_ |
![]() | |
std::string | ip_ |
std::optional< bool > | isAdmin_ |
Additional Inherited Members | |
![]() | |
Taggable (util::TagDecoratorFactory const &tagFactory) | |
New Taggable from a specified factory. | |
A class representing a connection to a client.
web::ng::Connection::Connection | ( | std::string | ip, |
boost::beast::flat_buffer | buffer, | ||
util::TagDecoratorFactory const & | tagDecoratorFactory ) |
Construct a new Connection object.
ip | The client ip. |
buffer | The buffer to use for reading and writing. |
tagDecoratorFactory | The factory for creating tag decorators. |
|
pure virtual |
Gracefully close the connection.
yield | The yield context. |
Implemented in web::ng::impl::HttpConnection< StreamType >, and web::ng::impl::WsConnection< StreamType >.
|
pure virtual |
Receive a request from the client.
yield | The yield context. |
Implemented in web::ng::impl::HttpConnection< StreamType >, and web::ng::impl::WsConnection< StreamType >.
|
pure virtual |
Send a response to the client.
response | The response to send. |
yield | The yield context. |
Implemented in web::ng::impl::HttpConnection< StreamType >, and web::ng::impl::WsConnection< StreamType >.
|
pure virtual |
Get the timeout for send, receive, and close operations. For WebSocket connections, this is the ping interval.
newTimeout | The new timeout to set. |
Implemented in web::ng::impl::HttpConnection< StreamType >, and web::ng::impl::WsConnection< StreamType >.
|
staticconstexpr |
The default timeout for send, receive, and close operations.