nrf9160 mqtt keep alive longer than 30 minutes not working

sdk: 1.6

modem fw: 1.2.3

Hi,

Been trying to test mqtt every which way and not getting any success with mqtt keep alive longer than 30 minutes, the mqtt connection is only maintained when the keepalive is less than 30 minutes. Two problems are:

1. setting KEEPALIVE values 1800 or larger than that, the connection just gets dropped.

2. Cant figure out how to set 'will message'. What I currently have in the code I get, "mqtt_connect... -12". which is #define ENOMEM 12 /* Not enough space */.

Removing the will message solves the connection issue, but keepalive issue persists.

Regards

Noaman

  • Hi Oyvind,

    I have attached the updated modem trace.

    once again: keepalive is 40 minutes

    mqtt publish freq: 40 min

    modem fw: 1.2.3

    ESP is connecting via Wifi. I have confirmed with Bell that connections of any sort are not being reset or terminated by them in 30 minutes. IP lease time is also in hours/days not in minutes.

    I do not want 30 minute keep alive. I want >12 hour keepalive. Our use-case for asset tracking requires 12 hours pings on idle and more frequent pings on motion. so we could be sending 5-10 pings on a daily basis for typical application. I do not want to establish a new connection every time as it adds up on power consumption as well as data requirements on reconnection especially on TLS. TLS session caching does reduce data consumption and connection time but it is still more than what a keepalive duration of 12 hours would allow us to acheive.

  • Thanks for providing the update. 

    Just to clarify, has Bell or Rogers support confirmed the NAT timeout on the network? NAT timeout is considered as a "chain", meaning that you are only "as strong as the weakest link" - i.e. if your one of your network chains has a lower than 350 seconds, that will be the NAT timeout for this specific network/APN.

    Perhaps GSMA's Whitepaper on Improving Energy Efficiency for Mobile IoT. can offer some insight on this. 

    Kind regards,
    Øyvind

Related