jsonrpcx / json-rpc-cxx

JSON-RPC for modern C++
MIT License
251 stars 44 forks source link

Peer to peer support #6

Closed AArnott closed 4 years ago

AArnott commented 4 years ago

JSON-RPC is fundamentally a p2p protocol. While many applications may have a client/server architecture, other applications find it useful to invoke methods bidirectionally over a connection.

We're looking to add our first C++ application to our network of JSON-RPC processes and would consider this project if it supported receiving and sending all sorts of JSON-RPC messages in both directions.

cinemast commented 4 years ago

Could you please elaborate a bit more what is messing for you? You could simply create a peer by including a server (for incoming messages) and a client (for outgoing messages).

AArnott commented 4 years ago

Can I do that over the same connection? If so, that's great and sorry for the noise. I couldn't find a sample that showed it so I wanted to verify that your project was an option for some possibly upcoming use case of ours.

cinemast commented 4 years ago

Connection semantics are out of the scope of this project. However the inmemory connector example (https://github.com/jsonrpcx/json-rpc-cxx/blob/master/examples/inmemoryconnector.hpp) acts as both client and server. This could be implemented for any bi-directional communication channel (e.g. zero-mq, redis, rabbitmq, plain sockets, etc.)