RPCClient.call

Make a function call on the RPC server.

  1. Response call(string func, JSONValue params)
    class RPCClient(API, Transport = TCPTransport)
    call
    (
    string func
    ,
    JSONValue params = JSONValue()
    )
    if (
    is(API == interface) &&
    isTransport!Transport
    )
  2. Response call(Request request)

Parameters

func string

The name of the remote function to call.

params JSONValue

A valid JSON array or Object containing the function parameters.

Return Value

Type: Response

The server's response.

Throws

std.json.JSONException if the string cannot be parsed as JSON.

Examples

interface MyAPI { void func(int val); }
auto client = new RPCClient!MyAPI("127.0.0.1", 54321);

import std.json : JSONValue, parseJSON;
auto resp = client.call("func", `{ "val": 3 }`.parseJSON);
auto resp2 = client.call("func", JSONValue(3));

Meta