Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
web::ng::impl::HttpConnection< StreamType > Class Template Reference
Inheritance diagram for web::ng::impl::HttpConnection< StreamType >:
Collaboration diagram for web::ng::impl::HttpConnection< StreamType >:

Public Member Functions

 HttpConnection (boost::asio::ip::tcp::socket socket, std::string ip, boost::beast::flat_buffer buffer, util::TagDecoratorFactory const &tagDecoratorFactory)
 
 HttpConnection (boost::asio::ip::tcp::socket socket, std::string ip, boost::beast::flat_buffer buffer, boost::asio::ssl::context &sslCtx, util::TagDecoratorFactory const &tagDecoratorFactory)
 
bool wasUpgraded () const override
 Whether the connection was upgraded. Upgraded connections are websocket connections.
 
std::optional< Error > sendRaw (boost::beast::http::response< boost::beast::http::string_body > response, boost::asio::yield_context yield) override
 
void setTimeout (std::chrono::steady_clock::duration newTimeout) override
 Get the timeout for send, receive, and close operations. For WebSocket connections, this is the ping interval.
 
std::optional< Error > send (Response response, boost::asio::yield_context yield) override
 Send a response to the client.
 
std::expected< Request, Error > receive (boost::asio::yield_context yield) override
 Receive a request from the client.
 
void close (boost::asio::yield_context yield) override
 Gracefully close the connection.
 
std::expected< bool, Error > isUpgradeRequested (boost::asio::yield_context yield) override
 
std::expected< ConnectionPtr, Error > upgrade (std::optional< boost::asio::ssl::context > &sslContext, util::TagDecoratorFactory const &tagDecoratorFactory, boost::asio::yield_context yield) override
 
- Public Member Functions inherited from web::ng::impl::UpgradableConnection
 Connection (std::string ip, boost::beast::flat_buffer buffer, util::TagDecoratorFactory const &tagDecoratorFactory)
 Construct a new Connection object.
 
- Public Member Functions inherited from web::ng::Connection
 Connection (std::string ip, boost::beast::flat_buffer buffer, util::TagDecoratorFactory const &tagDecoratorFactory)
 Construct a new Connection object.
 
- Public Member Functions inherited from util::Taggable
 Taggable (Taggable &&)=default
 
Taggableoperator= (Taggable &&)=default
 
BaseTagDecorator const & tag () const
 Getter for tag decorator.
 

Additional Inherited Members

- Static Public Attributes inherited from web::ng::Connection
static constexpr std::chrono::steady_clock::duration kDEFAULT_TIMEOUT = std::chrono::seconds{11}
 The default timeout for send, receive, and close operations.
 
- Protected Member Functions inherited from util::Taggable
 Taggable (util::TagDecoratorFactory const &tagFactory)
 New Taggable from a specified factory.
 
- Protected Attributes inherited from web::ng::Connection
boost::beast::flat_buffer buffer_
 

Member Function Documentation

◆ close()

template<typename StreamType >
void web::ng::impl::HttpConnection< StreamType >::close ( boost::asio::yield_context yield)
inlineoverridevirtual

Gracefully close the connection.

Parameters
yieldThe yield context.

Implements web::ng::Connection.

◆ isUpgradeRequested()

template<typename StreamType >
std::expected< bool, Error > web::ng::impl::HttpConnection< StreamType >::isUpgradeRequested ( boost::asio::yield_context yield)
inlineoverridevirtual

◆ receive()

template<typename StreamType >
std::expected< Request, Error > web::ng::impl::HttpConnection< StreamType >::receive ( boost::asio::yield_context yield)
inlineoverridevirtual

Receive a request from the client.

Parameters
yieldThe yield context.
Returns
The request if it was received or an error if the operation failed.

Implements web::ng::Connection.

◆ send()

template<typename StreamType >
std::optional< Error > web::ng::impl::HttpConnection< StreamType >::send ( Response response,
boost::asio::yield_context yield )
inlineoverridevirtual

Send a response to the client.

Parameters
responseThe response to send.
yieldThe yield context.
Returns
An error if the operation failed or nullopt if it succeeded.

Implements web::ng::Connection.

◆ sendRaw()

template<typename StreamType >
std::optional< Error > web::ng::impl::HttpConnection< StreamType >::sendRaw ( boost::beast::http::response< boost::beast::http::string_body > response,
boost::asio::yield_context yield )
inlineoverridevirtual

◆ setTimeout()

template<typename StreamType >
void web::ng::impl::HttpConnection< StreamType >::setTimeout ( std::chrono::steady_clock::duration newTimeout)
inlineoverridevirtual

Get the timeout for send, receive, and close operations. For WebSocket connections, this is the ping interval.

Parameters
newTimeoutThe new timeout to set.

Implements web::ng::Connection.

◆ upgrade()

template<typename StreamType >
std::expected< ConnectionPtr, Error > web::ng::impl::HttpConnection< StreamType >::upgrade ( std::optional< boost::asio::ssl::context > & sslContext,
util::TagDecoratorFactory const & tagDecoratorFactory,
boost::asio::yield_context yield )
inlineoverridevirtual

◆ wasUpgraded()

template<typename StreamType >
bool web::ng::impl::HttpConnection< StreamType >::wasUpgraded ( ) const
inlineoverridevirtual

Whether the connection was upgraded. Upgraded connections are websocket connections.

Returns
true if the connection was upgraded.

Implements web::ng::ConnectionMetadata.


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