From 49b7fdb832720116a5af6f1fcb2171acaefbbf35 Mon Sep 17 00:00:00 2001 From: Luca Date: Thu, 5 Sep 2024 16:59:16 +0200 Subject: [PATCH] feat: flush after write --- mqtt.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mqtt.lua b/mqtt.lua index e76c89d..0338cbc 100644 --- a/mqtt.lua +++ b/mqtt.lua @@ -142,6 +142,11 @@ function MqttClient:connect (username, password) return err end + local _, err = self.conn:flush() + if err ~= nil then + return err + end + self.is_connecting = true return nil @@ -163,6 +168,11 @@ function MqttClient:disconnect (reason) return err end + local _, err = self.conn:flush() + if err ~= nil then + return err + end + self.is_connecting = false self.is_connected = false