JSON-RPC 2.0
JSON-RPC 2.0 Modern C++ Library
|
A JSON-RPC server for handling requests and notifications. More...
#include <server.hpp>
Public Member Functions | |
Server (std::unique_ptr< transport::Transport > transport) | |
Constructs a Server with the specified transport. | |
void | Start () |
Starts the server to handle incoming JSON-RPC requests. | |
void | Stop () |
Stops the server from handling requests. | |
void | RegisterMethodCall (const std::string &method, const MethodCallHandler &handler) |
Registers an RPC method handler with the dispatcher. | |
void | RegisterNotification (const std::string &method, const NotificationHandler &handler) |
Registers an RPC notification handler with the dispatcher. | |
auto | IsRunning () const -> bool |
Checks if the server is currently running. | |
A JSON-RPC server for handling requests and notifications.
Manages the lifecycle of a JSON-RPC server, including starting and stopping, and registering RPC methods and notifications.
Definition at line 19 of file server.hpp.
|
explicit |
Constructs a Server with the specified transport.
transport | A unique pointer to the transport layer to use for communication. |
Definition at line 7 of file server.cpp.
|
nodiscard |
Checks if the server is currently running.
Definition at line 24 of file server.cpp.
void jsonrpc::server::Server::RegisterMethodCall | ( | const std::string & | method, |
const MethodCallHandler & | handler ) |
Registers an RPC method handler with the dispatcher.
method | The name of the RPC method to handle. |
handler | The function to handle the RPC method call. |
Definition at line 50 of file server.cpp.
void jsonrpc::server::Server::RegisterNotification | ( | const std::string & | method, |
const NotificationHandler & | handler ) |
Registers an RPC notification handler with the dispatcher.
method | The name of the RPC notification to handle. |
handler | The function to handle the RPC notification. |
Definition at line 55 of file server.cpp.
void jsonrpc::server::Server::Start | ( | ) |
Starts the server to handle incoming JSON-RPC requests.
Definition at line 13 of file server.cpp.
void jsonrpc::server::Server::Stop | ( | ) |
Stops the server from handling requests.
Definition at line 19 of file server.cpp.