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)

Make a function call on the RPC server.

notify
void notify(string func, JSONValue params)

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

// This is the list of functions on the RPC server.
interface MyRemoteFunctions {
    long func(string param) { return 56789; }
}

// Connect over TCP to a server on localhost.
auto rpc = new RPCClient!MyRemoteFunctions("127.0.0.1", 54321);
long retval = rpc.func("some string");
assert(retval == 56789);

Meta