v2026.6.4
All Bundles
Bundle JSON-RPC 2.0 client and server. Client sends method calls to a remote endpoint and returns typed results; Server dispatches incoming requests to registered handlers. Compile with -lib json_rpc.

Client

JSON RPC client

Operations

Call #

Call remote procedure

method : public : Call(func_name:String, func_params:JsonElement) ~ JsonElement

Parameters

NameTypeDescription
func_nameStringname of function to call
func_paramsJsonElementfunction call parameters

Return

TypeDescription
JsonElementJSON response

Example

client := Data.JSON.RPC.Client->New("localhost", 9090);
params := JsonParser->TextToElement("{\"x\": 10}");
result := client->Call("square", params); # invoke remote method
if(result <> Nil) {
  result->GetInt()->PrintLine(); # print returned value
};

GetLastError #

Get the last error

method : public : GetLastError() ~ Collection.Tuple.Pair<IntRef,String>

Return

TypeDescription
CollectionTuplePair<IntRef,String>last error

Example

client := Data.JSON.RPC.Client->New("localhost", 9090);
params := JsonParser->TextToElement("{}");
result := client->Call("missing_method", params);
if(result = Nil) {
  err := client->GetLastError(); # retrieve error code and message
  err->GetSecond()->PrintLine();
};

New # constructor

Constructor

New(address:String, port:Int)

Parameters

NameTypeDescription
addressStringserver address
portIntserver port

Example

client := Data.JSON.RPC.Client->New("localhost", 9090);
params := JsonParser->TextToElement("{\"a\": 3, \"b\": 4}");
result := client->Call("add", params);
if(result <> Nil) { result->GetInt()->PrintLine(); }; # 7