To disconnect from the Apache Kafka broker, set the WebSocket Client property Active to false. This closes the underlying TCP connection to the broker.
When the connection is closed, the OnKafkaDisconnect event is raised.
oClient.Active := False;
procedure OnKafkaDisconnect(Sender: TObject);
begin
ShowMessage('Disconnected from Kafka broker');
end;