TsgcWSPServer_WAMP › Events › OnCall
Fires when a client invokes a remote procedure; the handler must respond through CallResult, CallProgressResult or CallError.
property OnCall: TsgcWSCallEvent;
// TsgcWSCallEvent = procedure(Connection: TsgcWSConnection; const CallId, ProcUri, Arguments: string) of object
—
CallId is the identifier chosen by the caller and must be quoted back in the response. ProcUri is the full procedure URI (any prefix has already been resolved). Arguments carries the remaining items of the CALL array as a JSON-encoded payload — number, string, object, array or a comma-separated sequence for multi-argument calls. For each CALL the handler is expected to produce exactly one terminal response: call CallResult on success, CallError on failure, or zero-or-more CallProgressResult frames followed by a final CallResult when streaming partial results back to the caller.
procedure TForm1.WAMPServerCall(Connection: TsgcWSConnection;
const CallId, ProcUri, Arguments: string);
begin
if ProcUri = 'http://example.com/rpc/add' then
WSPServerWAMP1.CallResult(Connection, CallId, '42')
else
WSPServerWAMP1.CallError(Connection, CallId,
'http://example.com/errors/not-found', 'unknown procedure');
end;