Expand description
This crate implements multiple JSON-RPC clients. Currently available are: http
and websocket
. Only websocket
supports PubSub.
Instead of using a Client
implementation and calling Client::send_request
directly, you can derive a proxy
struct that implements methods for ergonomic RPC calling:
use async_trait::async_trait;
#[nimiq_jsonrpc_derive::proxy]
#[async_trait]
trait Foobar {
type Error;
async fn hello(&self, name: String) -> Result<String, Self::Error>;
}
§TODO
- Implement PubSub
- Proper error handling
Modules§
- http
- An implementation of JSON-RPC over HTTP post requests. Feature
http
must be enabled: - websocket
- An implementation of JSON-RPC over websockets. Feature
websocket
must be enabled:
Structs§
- ArcClient
- Wraps a client into an
Arc<Mutex<_>>
, so that it can be cloned. - Credentials
- Basic auth credentials, containing username and password.
Traits§
- Client
- This trait must be implemented by the client’s transport. It is responsible to send the request and return the server’s response.