TsgcWSPServer_WAMPEvents › OnCall

OnCall 事件

当客户端调用远程过程时触发;处理程序必须通过 CallResult、CallProgressResult 或 CallError 进行响应。

语法

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

默认值

备注

CallId 是调用方选择的标识符,必须在响应中原样返回。ProcUri 是完整的过程 URI(任何前缀已被解析)。Arguments 将 CALL 数组的剩余项作为 JSON 编码载荷携带,可以是数字、字符串、对象、数组,或多参数调用时以逗号分隔的序列。对于每次 CALL,处理程序应产生恰好一个终止响应:成功时调用 CallResult,失败时调用 CallError,或在向调用方流式传输部分结果时,先发送零或多个 CallProgressResult 帧,最后再发送一个 CallResult

示例


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;

返回事件