JSON-RPC 2.0
JSON-RPC 2.0 Modern C++ Library
Loading...
Searching...
No Matches
jsonrpc::server Namespace Reference

Classes

class  Dispatcher
 Dispatcher for JSON-RPC requests. More...
 
class  Request
 Represents a JSON-RPC request. More...
 
class  Response
 Represents a JSON-RPC response. More...
 
class  Server
 A JSON-RPC server for handling requests and notifications. More...
 

Typedefs

using ErrorInfoMap
 
using MethodCallHandler
 Type alias for method call handler functions.
 
using NotificationHandler
 Type alias for notification handler functions.
 
using Handler = std::variant<MethodCallHandler, NotificationHandler>
 Type alias for a handler which can be either a method call handler or a notification handler.
 

Enumerations

enum class  LibErrorKind {
  kParseError , kInvalidRequest , kMethodNotFound , kInternalError ,
  kServerError
}
 Enumeration for library error kinds. More...
 

Typedef Documentation

◆ ErrorInfoMap

Initial value:
std::unordered_map<LibErrorKind, std::pair<int, const char*>>

Definition at line 20 of file response.hpp.

◆ Handler

Type alias for a handler which can be either a method call handler or a notification handler.

Definition at line 33 of file types.hpp.

◆ MethodCallHandler

Initial value:
std::function<nlohmann::json(const std::optional<nlohmann::json> &)>

Type alias for method call handler functions.

Method call handlers take an optional JSON object as input and return a JSON object.

Definition at line 17 of file types.hpp.

◆ NotificationHandler

Initial value:
std::function<void(const std::optional<nlohmann::json> &)>

Type alias for notification handler functions.

Notification handlers take an optional JSON object as input and do not return a value.

Definition at line 26 of file types.hpp.

Enumeration Type Documentation

◆ LibErrorKind

enum class jsonrpc::server::LibErrorKind
strong

Enumeration for library error kinds.

Enumerator
kParseError 
kInvalidRequest 
kMethodNotFound 
kInternalError 
kServerError 

Definition at line 12 of file response.hpp.