TsgcWSPServer_WAMPEvents › OnRawMessage

OnRawMessage Event

Fires before WAMP decoding, letting the server inspect every incoming text frame and optionally suppress further processing.

Syntax

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

Default Value

Remarks

Called before the JSON array is parsed into a WAMP message, so Text is the verbatim frame (for example [5,"http://example.com/foo"] for SUBSCRIBE). Set Handled := True to consume the frame completely — the component will skip its own decoder and none of the dedicated events (OnCall, OnBeforeSubscription, OnPrefix…) will fire for that message. Leave Handled at False to use the event purely for logging, capture or a custom middleware that co-operates with the built-in decoder.

Example


procedure TForm1.WAMPServerRawMessage(Connection: TsgcWSConnection;
  const Text: string; var Handled: Boolean);
begin
  Memo1.Lines.Add(Format('[%s] raw: %s', [Connection.Guid, Text]));
  Handled := False;
end;

Back to Events