TsgcWebSocketLoadBalancerServer › 事件 › OnClientDisconnect
当下游客户端会话从负载均衡器中移除时触发,原因可能是客户端离开或后端终止。
property OnClientDisconnect: TsgcWSLBClientConnectionEvent;
// TsgcWSLBClientConnectionEvent = procedure(ServerConnection: TsgcWSConnection; ClientConnection: TsgcWSLoadBalancerClientConnection) of object
—
OnClientDisconnect 与 OnClientConnect 相对应,当与后端服务器配对的客户端从负载均衡器内部表中删除时触发。ServerConnection 标识处理该客户端的后端,ClientConnection 公开已释放的 TsgcWSLoadBalancerClientConnection,以便处理程序可以更新指标、关闭相关资源或从外部仪表板中注销会话。事件返回后,连接对象不再用于路由流量。
procedure OnClientDisconnect(ServerConnection: TsgcWSConnection;
ClientConnection: TsgcWSLoadBalancerClientConnection);
begin
Log('Client disconnected: ' + ClientConnection.Guid);
end;