All Projects → badaix → jsonrpcpp

badaix / jsonrpcpp

Licence: MIT license
C++ JSON-RPC 2.0 library

Programming Languages

C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to jsonrpcpp

JsonRpc.Standard
An asynchronous .NET Standard library for JSON RPC client & server implementation.
Stars: ✭ 27 (-72.16%)
Mutual labels:  json-rpc, rpc, json-rpc2
Jrpc
JSON-RPC implementation in C++17
Stars: ✭ 113 (+16.49%)
Mutual labels:  json-rpc, rpc
Remote Function
Make function calls to remote hosts seamlessly
Stars: ✭ 95 (-2.06%)
Mutual labels:  json-rpc, rpc
Rpc
Simple RPC style APIs with generated clients & servers.
Stars: ✭ 192 (+97.94%)
Mutual labels:  json-rpc, rpc
Getty
a netty like asynchronous network I/O library based on tcp/udp/websocket; a bidirectional RPC framework based on JSON/Protobuf; a microservice framework based on zookeeper/etcd
Stars: ✭ 532 (+448.45%)
Mutual labels:  json-rpc, rpc
Libjson Rpc Cpp
C++ framework for json-rpc (json remote procedure call)
Stars: ✭ 653 (+573.2%)
Mutual labels:  json-rpc, rpc
Jsonrpc
The jsonrpc package helps implement of JSON-RPC 2.0
Stars: ✭ 143 (+47.42%)
Mutual labels:  json-rpc, rpc
node-jsonrpc2
JSON-RPC 2.0 server and client library, with HTTP (with Websocket support) and TCP endpoints
Stars: ✭ 103 (+6.19%)
Mutual labels:  json-rpc, json-rpc2
Ether1
Official Go implementation of The Etho Protocol
Stars: ✭ 41 (-57.73%)
Mutual labels:  json-rpc, rpc
Spooky
An HttpClient based Json RPC 2.0/XML-RPC client for .Net.
Stars: ✭ 16 (-83.51%)
Mutual labels:  json-rpc, rpc
server
Implement the JSON-RPC 2.0 server specification for @laravel.
Stars: ✭ 154 (+58.76%)
Mutual labels:  json-rpc, rpc
Vs Streamjsonrpc
The StreamJsonRpc library offers JSON-RPC 2.0 over any .NET Stream, WebSocket, or Pipe. With bonus support for request cancellation, client proxy generation, and more.
Stars: ✭ 421 (+334.02%)
Mutual labels:  json-rpc, rpc
Joyrpc
high-performance, high-extensibility Java rpc framework.
Stars: ✭ 290 (+198.97%)
Mutual labels:  json-rpc, rpc
Rpc Codec
JSON-RPC 2.0 codec for Go net/rpc standard library
Stars: ✭ 87 (-10.31%)
Mutual labels:  json-rpc, rpc
aiohttp-rpc
A simple JSON-RPC for aiohttp
Stars: ✭ 22 (-77.32%)
Mutual labels:  json-rpc, rpc
Jsonrpcserver
Process JSON-RPC requests in Python
Stars: ✭ 126 (+29.9%)
Mutual labels:  json-rpc, rpc
scala-json-rpc
Let your servers and clients communicate over function calls! JSON-RPC 2.0 library for Scala and Scala.js
Stars: ✭ 38 (-60.82%)
Mutual labels:  json-rpc, rpc
xmlrpcwsc-dotnet
XML-RPC Web Service Client C# implementation
Stars: ✭ 30 (-69.07%)
Mutual labels:  json-rpc, rpc
coreipc
WCF-like service model API for communication over named pipes and TCP. .NET and node.js clients.
Stars: ✭ 22 (-77.32%)
Mutual labels:  json-rpc, rpc
jsonrpc2-zeromq-python
JSON-RPC 2.0 over ZeroMQ in Python
Stars: ✭ 52 (-46.39%)
Mutual labels:  json-rpc, json-rpc2

jsonrpc++

Leightweight C++ JSON-RPC 2.0 library

Github Releases Build Status Language grade: C/C++

What it is

jsonrpc++ parses and constructs JSON-RPC 2.0 objects, like

Example: Parsing a request

jsonrpcpp::entity_ptr entity = jsonrpcpp::Parser::do_parse(R"({"jsonrpc": "2.0", "method": "subtract", "params": {"subtrahend": 23, "minuend": 42}, "id": 3})");
if (entity->is_request())
{
    jsonrpcpp::request_ptr request = dynamic_pointer_cast<jsonrpcpp::Request>(entity);
    if (request->method() == "subtract")
    {
        int result = request->params().get<int>("minuend") - request->params().get<int>("subtrahend");
        jsonrpcpp::Response response(*request, result);
        cout << " Response: " << response.to_json().dump() << "\n";
        //will print: {"jsonrpc": "2.0", "result": 19, "id": 3}
    }
    else
        throw jsonrpcpp::MethodNotFoundException(*request);
}

What it not is

jsonrpc++ is completely transport agnostic, i.e. it doesn't care about transportation of the messages and there is no TCP client or server component shipped with this library.

As JSON backbone JSON for Modern C++ is used.

Some code example

jsonrpcpp::entity_ptr entity =
    jsonrpcpp::Parser::do_parse(R"({"jsonrpc": "2.0", "method": "subtract", "params": {"subtrahend": 23, "minuend": 42}, "id": 3})");
if (entity && entity->is_request())
{
    jsonrpcpp::request_ptr request = dynamic_pointer_cast<jsonrpcpp::Request>(entity);
    cout << " Request: " << request->method() << ", id: " << request->id() << ", has params: " << !request->params().is_null() << "\n";
    if (request->method() == "subtract")
    {
        int result;
        if (request->params().is_array())
            result = request->params().get<int>(0) - request->params().get<int>(1);
        else
            result = request->params().get<int>("minuend") - request->params().get<int>("subtrahend");

        jsonrpcpp::Response response(*request, result);
        cout << " Response: " << response.to_json().dump() << "\n";
    }
    else if (request->method() == "sum")
    {
        int result = 0;
        for (const auto& summand : request->params().param_array)
            result += summand.get<int>();
        jsonrpcpp::Response response(*request, result);
        cout << " Response: " << response.to_json().dump() << "\n";
    }
    else
    {
        throw jsonrpcpp::MethodNotFoundException(*request);
    }
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].