TsgcWebSocketServerEvents › OnLoadBalancerDisconnect

OnLoadBalancerDisconnect Event

Fires when the server disconnects from the Load Balancer Server.

Syntax

property OnLoadBalancerDisconnect: TsgcWSDisconnectEvent;
// TsgcWSDisconnectEvent = procedure(Connection: TsgcWSConnection; Code: Integer) of object

Default Value

Remarks

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.

Example


procedure OnLoadBalancerDisconnect(Connection: TsgcWSConnection; Code: Integer);
begin
  WriteLn(Format('#load balancer disconnected (code %d)', [Code]));
end;

Back to Events