TsgcWSPServer_WAMPEvents › OnCall

OnCall Gebeurtenis

Wordt geactiveerd wanneer een client een externe procedure aanroept; de handler moet reageren via CallResult, CallProgressResult of CallError.

Syntaxis

property OnCall: TsgcWSCallEvent;
// TsgcWSCallEvent = procedure(Connection: TsgcWSConnection; const CallId, ProcUri, Arguments: string) of object

Standaardwaarde

Opmerkingen

CallId is de identifier chosen by the caller and must be quoted back in de reactie. ProcUri is the full procedure URI (elk prefix has already been resolved). Arguments carries the resterend items of the CALL array as a JSON-encoded payload — number, tekenreeks, object, array or a comma-separated sequence for multi-argument calls. For elk CALL de handler is expected to produce exact 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.

Voorbeeld


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;

Terug naar gebeurtenissen