0

I am a little confused about who is supposed to send the MQTT keep alive pingreq when using the NodeMCU Lua libraries.

If I connect and regularly send messages then everything is ok. If I don't I get offline notification, and the mosquito server (running on Linux on a local machine) logs "Client clientid has exceeded timeout, disconnecting" as expected. changing the keepalive timer is reflected in the duration before disconnect.

I assumed that setting the keepalive would also cause the libraries to send the ping request. It would be useful if this was documented if this is the expected behaviour

Version info

NodeMCU 3.0.0.0 
        branch: dev
        commit: 88a33afd6e750d9be3d9e47ba7b3920cd73829da
        release: 2.0.0-master_20170202 +509
        release DTS: 202005011052
        SSL: false
        build type: float
        LFS: 0x20000 bytes total capacity
Marcel Stör
  • 22,695
  • 19
  • 92
  • 198
  • This depend whether your NodeMCU is a client or a publisher. See my answer to another question [here](https://stackoverflow.com/a/59941319/4902099) – hcheung Jun 03 '20 at 01:26
  • @hcheung thanks for that. I have looked that the mqtt.c as I am building from source, and it appears that the ping should be sent if the keepalive is set and there has been no communication within the keepalive timeout. Marcel, i see there is a lot of debugging around this. If you think it is worth it I am happy to try to enable debugging and see what is happening. I have never done this on the NodeMCU libs before, so let me know if that is practical. – Peter Bonham Jun 03 '20 at 02:20

0 Answers0