TsgcWSPClient_sgcMethods › RPC

RPC Method

Sends a remote procedure call request and awaits a Result or Error response.

Syntax

procedure RPC(const aId, aMethod: string; const aParams: string = ''; const aGuid: String = ''; const aQueue: TwsQueue = queueLevel0);

Parameters

NameTypeDescription
aIdconst stringUnique call identifier used to correlate the response. Leave empty to let the component generate a new Guid.
aMethodconst stringName of the remote method to invoke on the server.
aParamsconst stringOptional parameter payload (typically a JSON string).
aGuidconst StringOptional Guid of the target server-side sgc protocol instance. Leave empty to use the default.
aQueueconst TwsQueueQueue level used when the server applies transactional queuing to the call.

Remarks

The call is tracked locally in the RPC list; when the server responds, either OnRPCResult or OnRPCError fires with the matching Id and the entry is removed. Use GetRPCMethodById or GetRPCParamsById inside those handlers to retrieve the original request.

Example

oProtocol.RPC('', 'getUsers', '{"page":1}');

Back to Methods