JSONRPC2 v0.3.0 JSONRPC2.Clients.TCP
A client for JSON-RPC 2.0 using a line-based TCP transport.
Summary
Functions
Call the given method
with params
using the client pool named name
Asynchronously call the given method
with params
using the client pool named name
Send a notification with the given method
and params
using the client pool named name
Receive the response for a previous cast/3
which returned a request_id
Start a client pool named name
, connected to host
at port
Stop the client pool with name name
Types
host ::
binary |
:inet.socket_address |
:inet.hostname
request_id :: any
Functions
Specs
call(atom, JSONRPC2.method, JSONRPC2.params, boolean) ::
{:ok, any} |
{:error, any}
Call the given method
with params
using the client pool named name
.
For compatibility with pathological implementations, you can optionally pass true
for
the string_id
parameter to force the request ID to be a string.
Specs
cast(atom, JSONRPC2.method, JSONRPC2.params, boolean) ::
{:ok, request_id} |
{:error, :backlog_full}
Asynchronously call the given method
with params
using the client pool named name
.
Use receive_response/1
with the request_id
to get the response.
For compatibility with pathological implementations, you can optionally pass true
for
the string_id
parameter to force the request ID to be a string.
Specs
notify(atom, JSONRPC2.method, JSONRPC2.params) ::
{:ok, request_id} |
{:error, :backlog_full}
Send a notification with the given method
and params
using the client pool named name
.
This function returns a request_id
, but it should not be used with receive_response/1
.
Specs
receive_response(request_id) ::
{:ok, any} |
{:error, any}
Receive the response for a previous cast/3
which returned a request_id
.