JsonRPC.Transport behaviour (JsonRPC v0.1.0) View Source
The transport layer to send a JSON RPC to a server.
Link to this section Summary
Callbacks
Sends the given json_rpc
to a server.
Link to this section Callbacks
Specs
send_rpc(json_rpc :: String.t(), opts :: keyword()) :: :ok | {:ok, :notification} | {:ok, binary()} | {:error, term()}
Sends the given json_rpc
to a server.
This function gets the encoded JSON-RPC and the options of the client as arguments.
Returning :ok
indicates an asynchronous call or a notification in a
synchronous workflow. In an asynchronous workflow the function
JsonRPC.handle_response/1
must be called with the response from the server.
Returning {:ok, response}
runs the request/response loop with the JSON-RPC
response in the tuple.
Returning {:error, reason}
returns an error to the caller of the RPC.