tarantool / mqtt

Tarantool MQTT client
tarantool.org
BSD 2-Clause "Simplified" License
39 stars 10 forks source link

on_disconnect not work? #12

Closed vvzvlad closed 6 years ago

vvzvlad commented 6 years ago

In order to catch the problem with the connection, I use on_disconnect like this:

local function mqtt_disconnect_callback()
   print("MQTT disconnect!")
end
local function mqtt_connect_callback()
   print("MQTT connect!")
end
mqtt.wb:on_disconnect(mqtt_disconnect_callback)
mqtt.wb:on_connect(mqtt_connect_callback)

But in this case I get on_disconnect events about every second (together with on_connect). It seems to me that this is not the correct work of the subscription system for the disconnect event

2018-04-27 18:16:51.661 [61551] main/101/smart_sity_local.lua C> Tarantool 1.9.0-0-g14d33e3 2018-04-27 18:16:51.661 [61551] main/101/smart_sity_local.lua C> log level 4 2018-04-27 18:16:52.633 [61551] main C> entering the event loop MQTT connect! MQTT disconnect! MQTT connect! MQTT disconnect! MQTT connect! MQTT disconnect! MQTT connect! MQTT disconnect! ...

dedok commented 6 years ago

I guess, that you had a network issue. Can you retest this?

Thanks!

vvzvlad commented 6 years ago

Yes, this seems to fix the problems