TsgcWSPServer_WAMP › Events › OnDisconnect
Fires on the server when a WAMP client closes its WebSocket transport or the server drops it.
property OnDisconnect: TsgcWSDisconnectEvent;
// TsgcWSDisconnectEvent = procedure(Connection: TsgcWSConnection; Code: Integer) of object
—
Code carries the WebSocket close code (1000 normal, 1001 going away, 1006 abnormal) or the TCP error when a lower-level break occurs. All subscriptions and prefixes registered by this client are discarded internally before the handler runs, and the broker stops forwarding EVENT messages to it. Any pending RPC calls made by the client are considered abandoned — the server may simply stop dispatching their CallResult. This is the right place to release per-client resources attached to Connection.
procedure TForm1.WAMPServerDisconnect(Connection: TsgcWSConnection;
Code: Integer);
begin
Memo1.Lines.Add(Format('client %s disconnected (code %d)',
[Connection.Guid, Code]));
end;