TsgcWSPClient_DatasetEvents › OnEvent

OnEvent Event

Fires when a message is received on a subscribed channel.

Syntax

property OnEvent: TsgcWSCustomEvent;
// TsgcWSCustomEvent = procedure(Connection: TsgcWSConnection; const Channel, Text: string) of object

Default Value

Remarks

Delivers Publish notifications from other clients (or from the server) for channels the client has subscribed to. Channel holds the channel name and Text the payload exactly as it was published. Dataset synchronization messages are not routed through this event: they are dispatched to the specialized OnBeforeNewRecord / OnBeforeUpdateRecord / OnBeforeDeleteRecord and their After counterparts instead.

Example

procedure TForm1.oProtocolEvent(Connection: TsgcWSConnection; const Channel, Text: string);
begin
  Memo1.Lines.Add(Format('[%s] %s', [Channel, Text]));
end;

Back to Events