RawJsonRpcAutoClient

Used to create an auto-implemented raw Rpc client from an interface.

auto input = `{"jsonrpc":"2.0","id":2,"result":` ~ to!string(getValue!int) ~ "}";
auto istream = createMemoryStream(input.toBytes());
auto ostream = createMemoryOutputStream();

auto api = new RawJsonRpcAutoClient!IAPI(ostream, istream);

// test the client side:
// inputstream not processed: timeout
api.add(1, 2).shouldThrowExactly!RpcException;
ostream.str.should.be == JsonRpcRequest!int.make(1, "add", [1, 2]).toString();

// process input stream
api.client.tick();

// client must send a reponse
api.add(1, 2).should.be == getValue!int;

Constructors

this
this(OutputStream ostream, InputStream istream, RpcInterfaceSettings settings)
Undocumented in source.

Meta