TsgcWSPServer_WAMP › Methods › CallResult
Sends a CALLRESULT reply (message type 3) to the caller with the successful outcome of a previously received RPC.
procedure CallResult(const aCallId: String; const aResult: String = '');
| Name | Type | Description |
|---|---|---|
aCallId | const String | Identifier generated by the client when it originally invoked the remote procedure; used to correlate the reply with the pending call. |
aResult | const String | Outcome payload returned to the caller. Can be any value serialized as a String (number, quoted text, JSON object, JSON array, etc.). |
Call this method from inside an OnCall handler (or later, asynchronously) once the execution of the remote procedure has finished successfully. The server looks up the connection associated with aCallId, serializes a WAMP CALLRESULT frame [3, CallID, Result], dispatches it to the caller and removes the call from the pending list. If aCallId is not found (the call was never registered, or was already replied to/cancelled), the method does nothing. For RPCs that produce several chunks, use CallProgressResult for the intermediate pieces and CallResult for the final one; to report a failure use CallError instead.
procedure TForm1.sgcWSPServer_WAMP1Call(Connection: TsgcWSConnection;
const CallId, ProcURI: string; Arguments: TStringList);
begin
if ProcURI = 'com.example.add' then
sgcWSPServer_WAMP1.CallResult(CallId, '42');
end;