JSON-RPC 2.0
JSON-RPC 2.0 Modern C++ Library
|
Transport layer using Asio sockets for JSON-RPC communication with framing. More...
#include <framed_socket_transport.hpp>
Public Member Functions | |
FramedSocketTransport (const std::string &host, uint16_t port, bool is_server) | |
void | SendMessage (const std::string &message) override |
Sends a message in string to the transport layer. | |
auto | ReceiveMessage () -> std::string override |
Receives a message from the transport layer. | |
Public Member Functions inherited from jsonrpc::transport::SocketTransport | |
SocketTransport (const std::string &host, uint16_t port, bool is_server) | |
Constructs a SocketTransport. | |
~SocketTransport () override | |
SocketTransport (const SocketTransport &)=delete | |
auto | operator= (const SocketTransport &) -> SocketTransport &=delete |
SocketTransport (SocketTransport &&)=delete | |
auto | operator= (SocketTransport &&) -> SocketTransport &=delete |
void | SendMessage (const std::string &message) override |
Sends a message in string to the transport layer. | |
auto | ReceiveMessage () -> std::string override |
Receives a message from the transport layer. | |
Public Member Functions inherited from jsonrpc::transport::Transport | |
Transport ()=default | |
virtual | ~Transport ()=default |
Transport (const Transport &)=default | |
auto | operator= (const Transport &) -> Transport &=default |
Transport (Transport &&)=delete | |
auto | operator= (Transport &&) -> Transport &=delete |
Additional Inherited Members | |
Protected Member Functions inherited from jsonrpc::transport::SocketTransport | |
auto | GetSocket () -> asio::ip::tcp::socket & |
Static Protected Member Functions inherited from jsonrpc::transport::FramedTransport | |
static void | FrameMessage (std::ostream &output, const std::string &message) |
Constructs a framed message. | |
static auto | ReadHeadersFromStream (std::istream &input) -> HeaderMap |
static auto | ReadContentLengthFromStream (std::istream &input) -> int |
static auto | ReadContent (std::istream &input, std::size_t content_length) -> std::string |
Reads content from the input stream based on the content length. | |
static auto | ReceiveFramedMessage (std::istream &input) -> std::string |
Receives a framed message. | |
Static Protected Attributes inherited from jsonrpc::transport::FramedTransport | |
static constexpr const char * | kHeaderDelimiter = "\r\n\r\n" |
The delimiter used to separate headers from the message content. | |
Transport layer using Asio sockets for JSON-RPC communication with framing.
Definition at line 17 of file framed_socket_transport.hpp.
jsonrpc::transport::FramedSocketTransport::FramedSocketTransport | ( | const std::string & | host, |
uint16_t | port, | ||
bool | is_server ) |
Definition at line 11 of file framed_socket_transport.cpp.
|
overridevirtual |
Receives a message from the transport layer.
Implements jsonrpc::transport::Transport.
Definition at line 41 of file framed_socket_transport.cpp.
|
overridevirtual |
Sends a message in string to the transport layer.
request | The JSON-RPC request as a string. |
Implements jsonrpc::transport::Transport.
Definition at line 19 of file framed_socket_transport.cpp.
References jsonrpc::transport::FramedTransport::FrameMessage(), and jsonrpc::transport::SocketTransport::GetSocket().