TsgcWSPServer_sgcEvents › OnMessage

OnMessage Event

Fires when a client sends a plain text message wrapped in the sgc envelope.

Syntax

property OnMessage: TsgcWSMessageEvent;
// TsgcWSMessageEvent = procedure(Connection: TsgcWSConnection; const Text: string) of object

Default Value

Remarks

Raised when a client calls WriteData, or receives a Broadcast whose method field is message. The sgc envelope is already stripped, so Text holds the payload as the client sent it. Subscribe/Publish traffic does not flow through this event — publications surface on OnBeforePublish (server side) and on OnEvent (client side).

Example

procedure TForm1.oProtocolMessage(Connection: TsgcWSConnection; const Text: string);
begin
  Memo1.Lines.Add(Connection.Guid + ': ' + Text);
end;

Back to Events