mycognosist / solar

A minimal Secure Scuttlebutt replication node.
Other
22 stars 2 forks source link

Add JSON-RPC server #2

Closed mycognosist closed 1 year ago

mycognosist commented 1 year ago

JSON-RPC provides a means of exposing a user interface for the solar node. This means that MUXRPC is only used for node-to-node interactions (primarily replication).

Why websockets?

Can be queried natively and in-browser without much hassle.

Why https://crates.io/crates/jsonrpc-ws-server and not https://crates.io/crates/jsonrpsee-ws-server?

jsonrpsee is based on the tokio runtime. Since solar is based on async_std, this means we would have to run two async runtimes during the execution of solar. I deem this to be an unacceptable resource burden. jsonrpc-ws-server is synchronous and lightweight.


This PR introduces a new JSON-RPC actor with two endpoints: ping and whoami. It shuts down gracefully when a termination signal is received from the broker. More endpoints to follow.