This module implements a JSON RPC compliant client. The three predicates require a stream pair (see stream_pair/2) that connects us to a JSON RPC server.
If Stream is closed this library terminates the thread and related message queue.
Options are passed to json_write_dict/3 and thread_get_message/3. Additional options:
call(Closure, Data) from the client reading thread when the
request is completed. If Closure is true, ignore
the reply. As we cannot inject errors as exceptions in the calling
thread, possible errors are printed.json_rpc_client:<N>, where N
is a unique number.| Goal | is a callable term. The functor name is
the method. If there is a single argument that is a dict, we invoke a
JSON-RPC method using named arguments. If there is a single
argument that is a list, use the elements of the list as positional
arguments. If there are zero or more than one arguments use these as
positional arguments. Examples:
Options processed: |
error(Dict), where Dict holds the
code, message and optional data
field. Note that error(Dict) is not a valid JSON type and
this is thus unambiguous. While the JSON RPC standard allows the server
to process the messages in any order and allows for concurrent
processing, all results are sent in one message and this client ensures
the elements of the Results list are in the same order as the Calls
list. If the Calls list is empty this predicate does not wait
for a reply.library(jso_rpc_server)
in the module derived from the Options list.