TsgcWSPServer_sgcEvents › OnNotification

OnNotification Event

Dispara quando um cliente envia uma Notification JSON-RPC (sem Id, nenhuma resposta esperada).

Sintaxe

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

Valor Padrão

Observações

As notificações usam o mesmo envelope method/params das chamadas RPC, mas não carregam Id, sinalizando que o cliente não espera uma resposta. As chamadas com um Id são despachadas para OnRPC. Params é o texto JSON bruto do objeto/array de parâmetros — faça parse dele com um leitor JSON antes de usar.

Exemplo

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

Voltar para Eventos