TsgcWSPServer_DatasetEvents › OnRawMessage

OnRawMessage Event

Fires before a text message is decoded, allowing the handler to consume it.

Syntax

property OnRawMessage: TsgcWSRawMessageEvent;
// TsgcWSRawMessageEvent = procedure(Connection: TsgcWSConnection; const Text: string; var Handled: Boolean) of object

Default Value

Remarks

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.

Example

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;

Back to Events