|
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::expected< void, 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. | |
| Public Member Functions inherited from web::ng::ConnectionMetadata | |
| 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. | |
| void | setIp (std::string newIp) |
| Set 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. | |
| Public Member Functions inherited from util::Taggable | |
| 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_ |
| Protected Attributes inherited from web::ng::ConnectionMetadata | |
| std::string | ip_ |
| std::optional< bool > | isAdmin_ |
Additional Inherited Members | |
| Protected Member Functions inherited from util::Taggable | |
| 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 >, web::ng::impl::HttpConnection< boost::asio::ssl::stream< boost::beast::tcp_stream > >, web::ng::impl::HttpConnection< boost::beast::tcp_stream >, web::ng::impl::WsConnection< StreamType >, web::ng::impl::WsConnection< boost::asio::ssl::stream< boost::beast::tcp_stream > >, and web::ng::impl::WsConnection< boost::beast::tcp_stream >.
|
pure virtual |
Receive a request from the client.
| yield | The yield context. |
Implemented in web::ng::impl::HttpConnection< StreamType >, web::ng::impl::HttpConnection< boost::asio::ssl::stream< boost::beast::tcp_stream > >, web::ng::impl::HttpConnection< boost::beast::tcp_stream >, web::ng::impl::WsConnection< StreamType >, web::ng::impl::WsConnection< boost::asio::ssl::stream< boost::beast::tcp_stream > >, and web::ng::impl::WsConnection< boost::beast::tcp_stream >.
|
pure virtual |
Send a response to the client.
| response | The response to send. |
| yield | The yield context. |
Implemented in web::ng::impl::HttpConnection< StreamType >, web::ng::impl::HttpConnection< boost::asio::ssl::stream< boost::beast::tcp_stream > >, web::ng::impl::HttpConnection< boost::beast::tcp_stream >, web::ng::impl::WsConnection< StreamType >, web::ng::impl::WsConnection< boost::asio::ssl::stream< boost::beast::tcp_stream > >, and web::ng::impl::WsConnection< boost::beast::tcp_stream >.
|
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 >, web::ng::impl::HttpConnection< boost::asio::ssl::stream< boost::beast::tcp_stream > >, web::ng::impl::HttpConnection< boost::beast::tcp_stream >, web::ng::impl::WsConnection< StreamType >, web::ng::impl::WsConnection< boost::asio::ssl::stream< boost::beast::tcp_stream > >, and web::ng::impl::WsConnection< boost::beast::tcp_stream >.
|
staticconstexpr |
The default timeout for send, receive, and close operations.