Hi!
Thank you, this works:
procedure TForm1.DisconnectMqtt();
begin
mqttClient.Publish('test/is_online', 'False', qosExactlyOnce, True);
while mqttClient.Session.HasOutgoingPackets do begin
Sleep(2);
end;
mqttClient.Disconnect;
end;
So why not introduce a parameter to the Disconnect function which does exactly that?