AqualinkD icon indicating copy to clipboard operation
AqualinkD copied to clipboard

Frequent Disconnects from MQTT Broker due to short keepalive

Open shbatm opened this issue 3 years ago • 1 comments

After successful setup and connection to my MQTT Broker: (Mosquitto Add-on for Home Assistant), running on another server, I was noticing frequent disconnects from the broker every ~2 minutes with 10s delays between reconnection.

I recompiled the code changing this line to

    opts.keep_alive = 60;

And the reconnect issue went away. I'm not sure if there's another reason the keep-alive is set so much shorter than the MQTT default 60s, but resetting it has kept everything connected.

Not sure if this is just an issue for me or if its more widespread. If there's another reason for it being so short, maybe this could be a config option?

Otherwise, thanks for the program, working great so far!

shbatm avatar Dec 09 '20 03:12 shbatm

Thanks for doing the groundwork on this. There is a lot of history behind that setting both with bugs in mongoose and mosquitto documentation. It’s probably the latest version of mosquitto that’s highlighted this again, at one point I used my own ping rather than mongoose and may have to resort back to that as to not break all the different versions people run. But hope a simple config addition like you suggested will work.

sfeakes avatar Dec 09 '20 20:12 sfeakes