SRPC-Batch is an extension to SRPC. The batch-mode carries multiple remote procedure calls in a single transaction. The global "Method" indicates the batch mode. Individual RPCs are prefixed by an index, e.g. "1:Method=...".
- C: Method=Batch
- C: 0:Method=GetQuote
- C: 0:Symbol=GOOG
- C: 1:Method=GetQuote
- C: 1:Symbol=APPL
- S: Status=1
- S: 0:Status=1
- S: 0:Average=123
- S: 0:Low=121
- S: 0:High=125
- S: 1:Status=1
- S: 1:Average=456
- S: 1:Low=455
- S: 1:High=457
In rare cases clients want to execute not just one, but multiple commands. This saves network bandwidth and roundtrip time, especially on SSL connections. It also allows a batch of RPCs to be executed consecutively. We are using batch commands also to store them in the database and execute multiple commands on request.
- the request has a "Method=Batch",
- the request contains multiple remote procedure calls,
- parameters of individual RPCs are prefixed by an index N and a colon: "N:", e.g. "1:",
- the index indicates individual RPCs,
- all parameters of an individual RPC have the same index,
- the index starts with "0" (zero),
- each RPC has a "Method" parameter (1:Method=...),
- meta parameters as usual: "1:Symbol/Encoding=cstring",
- the response has a "Status=..." (0/1) indicating success of the batch-parser,
- the response carries a "Status" for each individual request,
- result parameters use the same syntax as the requests (1:Status=...),
- RPC results have the the same index as the corresponding request,
- the receiver executes ALL commands and returns their result even if some fail.
- the batch-extension is optional. It is not required for receivers. Better ask your server if it is supported,
- in additon to "Method", the request may have additional "global" parameters.