TsgcWSPServer_sgc事件 › OnNotification

OnNotification 事件

当客户端发送 JSON-RPC 通知(无 Id,无需回复)时触发。

语法

property OnNotification: TsgcWSNotificationEvent;
// TsgcWSNotificationEvent = procedure(Connection: TsgcWSConnection; const Method, Params: string) of object

默认值

备注

通知使用与 RPC 调用相同的 method/params 信封,但不携带 Id,表示客户端不期望收到回复。携带 Id 的调用将被派发至 OnRPC。Params 是参数对象/数组的原始 JSON 文本,使用前需用 JSON 读取器解析。

示例

procedure TForm1.oProtocolNotification(Connection: TsgcWSConnection;
  const Method, Params: string);
begin
  Memo1.Lines.Add(Format('%s -> %s(%s)', [Connection.Guid, Method, Params]));
end;

返回事件