Closed tje3d closed 5 years ago
Hmm, this sounds like the default keepalive period(60s), try setting this to a lower value, i.e.
client.keepAlivePeriod = 20;
@shamblett yes that's it. But it seems the behavior is wrong.
Ok, in what sense, do you mean the behaviour is wrong? 60 seconds seems a fairly common value, some of this depends on your broker of course. A value of 0 disables keep alive, is this what you would prefer as a default?
Ahh i was wrong, i thought that connection should be always up and Automatically reconnect when disconnected, as i seen in Paho.
It seems this package works properly (http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc385349238).
But I think it should disconnect client only if it is idle for keepAlive time. (not sure if receiving packet count as activation).
Anyway thanks for your perfect job.
OK, no probs, closing
Here is my connection code in flutter (mqtt_client: ^3.3.4):
Code:
The problem is, Sometimes without any reason, i get disconnected from server also when trying to publish a message.
I'm sure this is a library issue cause i have no problem with paho.mqtt.
Edit:
It's disconnect exactly every minute.