TsgcWSPServer_sgc › Events › OnMessage
Fires when a client sends a plain text message wrapped in the sgc envelope.
property OnMessage: TsgcWSMessageEvent;
// TsgcWSMessageEvent = procedure(Connection: TsgcWSConnection; const Text: string) of object
—
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).
procedure TForm1.oProtocolMessage(Connection: TsgcWSConnection; const Text: string);
begin
Memo1.Lines.Add(Connection.Guid + ': ' + Text);
end;