JSON::RPC::Client
A JSON-RPC 2.0 client. Builds requests, hands them to a {Transport}, and decodes the responses — raising {Error} for protocol errors and {TransportError} for transport failures.
client = JSON::RPC::Client.new("http://localhost:8080/rpc")
sum = client.call("add", {a: 2, b: 3}).as_i
client.notify("log", {level: "info", text: "done"})
Constructors
new(transport : Transport)
SourceConvenience constructor that builds an {HTTPTransport} for uri.
Instance methods
Invokes method with params and returns the result.
params may be any JSON-serializable value, or nil to send no
params member. Raises {Error} when the peer reports a JSON-RPC error
and {TransportError} on a transport failure.
Sends a notification: a request with no id, for which the peer must
not reply. Returns immediately after the transport accepts the request.