TsgcWebSocketLoadBalancerServerEvents › OnServerConnect

OnServerConnect Event

Fires when a backend WebSocket server connects to the load balancer to register itself.

Syntax

property OnServerConnect: TsgcWSLBServerConnectEvent;
// TsgcWSLBServerConnectEvent = procedure(Connection: TsgcWSConnection) of object

Default Value

Remarks

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.

Example


procedure OnServerConnect(Connection: TsgcWSConnection);
begin
  Log('Backend connected from ' + Connection.PeerIP);
end;

Back to Events