RPCClient

Implementation of a JSON-RPC client.

More...

Constructors

this
this(string host, ushort port)

Instantiate an RPCClient bound to the specified host.

Members

Functions

batch
Response[long] batch(BatchRequest[] requests...)

Execute a batch of function calls.

call
Response call(Request request)

Send a Request object to the server.

call
Response call(string func, JSONValue params = JSONValue())

Make a function call on the RPC server.

notify
void notify(string func, JSONValue params = JSONValue())

Send a notification to the server.

opDispatch
auto ref opDispatch(ARGS args)

Make a blocking remote call with natural syntax.

Detailed Description

Template Parameters

API = An interface containing the function definitions to call on the remote server. <BR> Transport = The network transport to use; by default, we use a TCPTransport.

Examples

1 // This is the list of functions on the RPC server.
2 interface MyRemoteFunctions {
3     long func(string param) { return 56789; }
4 }
5 
6 // Connect over TCP to a server on localhost.
7 auto rpc = new RPCClient!MyRemoteFunctions("127.0.0.1", 54321);
8 long retval = rpc.func("some string");
9 assert(retval == 56789);

Meta