Clio  develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
web::ng::Connection Class Referenceabstract

A class representing a connection to a client. More...

#include <Connection.hpp>

Inheritance diagram for web::ng::Connection:
Collaboration diagram for web::ng::Connection:

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 util::Taggable
 Taggable (Taggable &&)=default
Taggableoperator= (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_

Additional Inherited Members

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

Detailed Description

A class representing a connection to a client.

Constructor & Destructor Documentation

◆ Connection()

web::ng::Connection::Connection ( std::string ip,
boost::beast::flat_buffer buffer,
util::TagDecoratorFactory const & tagDecoratorFactory )

Construct a new Connection object.

Parameters
ipThe client ip.
bufferThe buffer to use for reading and writing.
tagDecoratorFactoryThe factory for creating tag decorators.

Member Function Documentation

◆ close()

◆ receive()

virtual std::expected< Request, Error > web::ng::Connection::receive ( boost::asio::yield_context yield)
pure virtual

◆ send()

virtual std::expected< void, Error > web::ng::Connection::send ( Response response,
boost::asio::yield_context yield )
pure virtual

◆ setTimeout()

virtual void web::ng::Connection::setTimeout ( std::chrono::steady_clock::duration newTimeout)
pure virtual

Member Data Documentation

◆ kDEFAULT_TIMEOUT

std::chrono::steady_clock::duration web::ng::Connection::kDEFAULT_TIMEOUT = std::chrono::seconds{11}
staticconstexpr

The default timeout for send, receive, and close operations.

Note
This value should be higher than forwarding timeout to not disconnect clients if rippled is slow.

The documentation for this class was generated from the following files:
  • /__w/clio/clio/src/web/ng/Connection.hpp
  • /__w/clio/clio/src/web/ng/Connection.cpp