Implementation of a JSON-RPC client.
Implementation of a JSON-RPC server.
Standard error codes.
Create a BatchRequest to pass to an RPCClient's batch function.
Deserialize a JSON Object to the specified aggregate D type.
Execute an RPC method and return the server's response.
Handles all of an individual client's requests.
Serialize a struct to a JSON Object.
An RPC request constructed by the client to send to the RPC server.
The RPC server's response sent to clients.
enum hostname = "127.0.0.1"; enum ushort port = 54321; interface API { long add(int a, int b); } class ServeFunctions { long add(int a, int b) { return a + b; } } void main(string[] args) { import core.thread : Thread; import core.time : dur; auto t = new Thread({ auto rpc = new RPCServer!ServeFunctions(hostname, port); rpc.listen(); }); t.isDaemon = true; t.start(); Thread.sleep(dur!"seconds"(2)); auto client = new RPCClient!API(hostname, port); assert(client.add(2, 2) == 4); assert(client.add(5, 6) == 11); }
Copyright 2018 Ryan Frame
MIT
JSON-RPC 2.0 protocol library.
The JSON-RPC 2.0 specification may be found at http://www.jsonrpc.org/specification