JSON-RPC 2.0
JSON-RPC 2.0 Modern C++ Library
Loading...
Searching...
No Matches
types.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <optional>
4#include <string>
5#include <string_view>
6#include <variant>
7
8#include <asio.hpp>
9#include <nlohmann/json.hpp>
10
11namespace jsonrpc::endpoint {
12
13constexpr std::string_view kJsonRpcVersion = "2.0";
14
15using RequestId = std::variant<int64_t, std::string>;
16
18 nlohmann::json(const std::optional<nlohmann::json>& params);
19
20using NotificationHandler = void(const std::optional<nlohmann::json>& params);
21
22using Handler = std::variant<MethodCallHandler, NotificationHandler>;
23
24constexpr auto kDefaultRequestTimeout = std::chrono::milliseconds(30000);
25
26constexpr size_t kDefaultMaxBatchSize = 100;
27
28} // namespace jsonrpc::endpoint
void(const std::optional< nlohmann::json > &params) NotificationHandler
Definition types.hpp:20
nlohmann::json(const std::optional< nlohmann::json > &params) MethodCallHandler
Definition types.hpp:17
std::variant< int64_t, std::string > RequestId
Definition types.hpp:15
constexpr std::string_view kJsonRpcVersion
Definition types.hpp:13
std::variant< MethodCallHandler, NotificationHandler > Handler
Definition types.hpp:22
constexpr size_t kDefaultMaxBatchSize
Definition types.hpp:26
constexpr auto kDefaultRequestTimeout
Definition types.hpp:24