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)

Construct a predefined error response to send to the client.

Members

Functions

toJSONString
string toJSONString(Flag!"prettyPrint" prettyPrint)

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

Properties

error
JSONValue error [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
hasError
bool hasError [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
id
T id [@property getter]

Get the id of the Response.

idType
JSONType idType [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
result
JSONValue result [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.

Static functions

fromJSONString
Response fromJSONString(char[] str)

Construct an Response from a JSON string.

Variables

_data
JSONValue _data;
Undocumented in source.

Examples

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

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

Meta