Response

The RPC server's response sent to clients.

Constructors

this
this(T id, JSONValue result)

Construct a response to send to the client.

this
this(T id, StandardErrorCode error, JSONValue errData = JSONValue())

Construct a predefined error response to send to the client.

Members

Functions

toJSONString
string toJSONString(Flag!"prettyPrint" prettyPrint = No.prettyPrint)

Convert the Response to a JSON string to send to the client.

Properties

id
T id [@property getter]

Get the id of the Response.

Static functions

fromJSONString
Response fromJSONString(const char[] str)

Construct an Response from a JSON string.

Examples

auto response = rpc.call("func", [1, 2, 3]);

if (response.hasError()) writeln(response.error);
else writeln(response.result);

Meta