TsgcWebSocketLoadBalancerServer › Events › OnConnect
Fires when a WebSocket connection (client or backend server) is established with the load balancer.
property OnConnect: TsgcWSConnectEvent;
// TsgcWSConnectEvent = procedure(Connection: TsgcWSConnection) of object
—
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.
procedure OnConnect(Connection: TsgcWSConnection);
begin
Log('Connected: ' + Connection.Guid + ' from ' + Connection.PeerIP);
end;