TsgcWebSocketLoadBalancerServer › Events › OnServerConnect
Fires when a backend WebSocket server connects to the load balancer to register itself.
property OnServerConnect: TsgcWSLBServerConnectEvent;
// TsgcWSLBServerConnectEvent = procedure(Connection: TsgcWSConnection) of object
—
OnServerConnect is raised when a TsgcWebSocketServer or TsgcWebSocketHTTPServer configured with LoadBalancer.Enabled opens the control WebSocket against this load balancer. At this stage the backend has completed the handshake but has not yet announced its Guid or Bindings, so it cannot accept traffic; use OnServerReady for that point. Typical uses are logging the connecting backend, validating the peer IP, or running a sanity check against an allowlist. The Connection parameter is the control channel to the backend.
procedure OnServerConnect(Connection: TsgcWSConnection);
begin
Log('Backend connected from ' + Connection.PeerIP);
end;