feat: flush after write

This commit is contained in:
Luca 2024-09-05 16:59:16 +02:00
parent ecebc72d3b
commit 49b7fdb832
1 changed files with 10 additions and 0 deletions

View File

@ -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