256dpi / arduino-mqtt

MQTT library for Arduino
MIT License
1.01k stars 232 forks source link

setKeepAlive #223

Closed jlgoasis closed 3 years ago

jlgoasis commented 3 years ago

Hi Joel,

Were is declared client.setKeepAlive(xx)? I tried in the void setup() after client.begin() but it doesn't work. Could you give an example, please.

Due I'm interested to avoid the keep alive mqtt messages, will client.setKeepAlive(0) do it?

Thank you

256dpi commented 3 years ago

Yes, client.setKeepAlive() should be called before client.begin(). However, depending on your MQTT broker a default keep alive my still be applied (shiftr.io does for example).

jlgoasis commented 3 years ago

And please, confirm if client.setKeppAlive(0) means MQTT client doesn't publishing any data

256dpi commented 3 years ago

It will not send any ping packets, if that's what you mean.