RPCClient.notify

Send a notification to the server.

A notification is a function call with no reply requested. Note that this is different than calling a function that returns void - in the latter case a response is still received with a null result; if a notification calls a function that returns a value, that return value is not sent to the client.

class RPCClient(API, Transport = TCPTransport)
void
notify
(
string func
,
JSONValue params = JSONValue()
)
if (
is(API == interface) &&
isTransport!Transport
)

Parameters

func string

The name of the remote function to call.

params JSONValue

A valid JSON array or Object containing the function parameters.

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;
client.notify("func", `{ "val": 3 }`.parseJSON);
client.notify("func", JSONValue(3));

Meta