TsgcWebSocketLoadBalancerServerEvents › OnRawMessage

OnRawMessage Event

Fires when any WebSocket text frame arrives, before higher-level protocols or the forwarder process it.

Syntax

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

Default Value

Remarks

OnRawMessage is the lowest-level text callback on the load balancer and is invoked before OnMessage or any subprotocol dispatch runs. Text holds the raw UTF-8 payload exactly as received; set Handled to True to consume the frame entirely (no forwarding, no further dispatch) or leave it False to let the normal processing pipeline continue. Use it to trace every text frame without affecting dispatch, or to sniff and veto specific patterns before the higher-level handlers see them.

Example


procedure OnRawMessage(Connection: TsgcWSConnection; const Text: string;
  var Handled: Boolean);
begin
  TraceLog.Add(Connection.Guid + ' > ' + Text);
  Handled := False;
end;

Back to Events