TsgcWebSocketServer › Events › OnLoadBalancerDisconnect
Fires when the server disconnects from the Load Balancer Server.
property OnLoadBalancerDisconnect: TsgcWSDisconnectEvent;
// TsgcWSDisconnectEvent = procedure(Connection: TsgcWSConnection; Code: Integer) of object
—
OnLoadBalancerDisconnect is raised when the side connection to the Load Balancer Server is closed, either because the server was deactivated, the Load Balancer closed the session, or the TCP connection was dropped. The Code parameter carries the WebSocket close code reported by the peer (1000 for a normal closure, 1006 for an abnormal drop...). If LoadBalancer.AutoRestart is set to a non-zero value the server will try to reconnect automatically after the configured number of seconds.
procedure OnLoadBalancerDisconnect(Connection: TsgcWSConnection; Code: Integer);
begin
WriteLn(Format('#load balancer disconnected (code %d)', [Code]));
end;