TsgcWSPServer_Dataset › Events › OnRawMessage
Fires before a text message is decoded, allowing the handler to consume it.
property OnRawMessage: TsgcWSRawMessageEvent;
// TsgcWSRawMessageEvent = procedure(Connection: TsgcWSConnection; const Text: string; var Handled: Boolean) of object
—
Raised for every text frame before the subprotocol parses the sgc or dataset envelope. Text is the raw string as delivered on the wire. Set Handled to True to take over the message; the server then skips envelope parsing, dataset application, RPC dispatch and OnMessage/OnNotification/OnRPC for this frame. Leave it False to keep the default behaviour.
procedure TForm1.oProtocolRawMessage(Connection: TsgcWSConnection;
const Text: string; var Handled: Boolean);
begin
if Text.StartsWith('PING') then
begin
oProtocol.WriteData(Connection.Guid, 'PONG');
Handled := True;
end;
end;