TsgcWebSocketLoadBalancerServer › Events › OnMessage
Fires when the load balancer receives a text WebSocket frame on one of its own sessions.
property OnMessage: TsgcWSMessageEvent;
// TsgcWSMessageEvent = procedure(Connection: TsgcWSConnection; const Text: string) of object
—
OnMessage is inherited from the underlying HTTP/WebSocket server and fires when a complete text frame is received on a connection terminated by the load balancer (typically control traffic or frames that are not routed to a backend). Text carries the decoded UTF-8 payload. For text traffic received on sessions that are being forwarded to a backend, use OnClientMessage instead, which also exposes the Handled flag that lets you intercept and short-circuit the forwarder.
procedure OnMessage(Connection: TsgcWSConnection; const Text: string);
begin
Log('Received from ' + Connection.Guid + ': ' + Text);
end;