TsgcWSPServer_sgcEventos › OnNotification

OnNotification Evento

Se genera cuando un cliente envía una notificación JSON-RPC (sin Id, sin respuesta esperada).

Sintaxis

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

Valor Predeterminado

Observaciones

Las notificaciones utilizan el mismo sobre método/parámetros que las llamadas RPC, pero no llevan Id, lo que indica que el cliente no espera respuesta. Las llamadas con Id se despachan a OnRPC en su lugar. Params es el texto JSON sin procesar del objeto/array de parámetros — analícelo con un lector JSON antes de usarlo.

Ejemplo

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

Volver a Eventos