TsgcWebSocketLoadBalancerServerEvents › OnConnect

OnConnect Event

Fires when a WebSocket connection (client or backend server) is established with the load balancer.

Syntax

property OnConnect: TsgcWSConnectEvent;
// TsgcWSConnectEvent = procedure(Connection: TsgcWSConnection) of object

Default Value

Remarks

OnConnect is inherited from the underlying HTTP/WebSocket server and fires for every WebSocket session accepted by the load balancer, including both downstream clients and the control channel used by backend servers to register themselves. The Connection parameter exposes Guid, PeerIP, protocol, and authentication state. For load-balancer specific notifications that distinguish clients from backends, use OnClientConnect and OnServerConnect instead; those fire after the load balancer has classified and paired the session.

Example


procedure OnConnect(Connection: TsgcWSConnection);
begin
  Log('Connected: ' + Connection.Guid + ' from ' + Connection.PeerIP);
end;

Back to Events