TsgcWSPServer_sgc › Events › OnDisconnect
Fires when a client disconnects from the server.
property OnDisconnect: TsgcWSDisconnectEvent;
// TsgcWSDisconnectEvent = procedure(Connection: TsgcWSConnection; Code: Integer) of object
—
Raised after the connection is closed, for any reason (client-initiated, server-initiated, or socket error). Before the event fires the subprotocol cleans up the connection's QoS entries and releases every subscription, so subscriber lists observed in other handlers no longer include this client. Code carries the WebSocket close code (1000 for a clean shutdown).
procedure TForm1.oProtocolDisconnect(Connection: TsgcWSConnection; Code: Integer);
begin
Memo1.Lines.Add(Format('%s left with code %d', [Connection.Guid, Code]));
end;