MQTT connection dropped with LTE-M

Hi all,
I'm experiencing issues with MQTT client connection on an nRF9160 board via LTE-M.
Some context: I'm trying to connect to a MQTT broker via LTE-M (actually public test brokers like HIVEMQ or mosquitto) with a hour keepalive timeout. For LTE-M connectivity, eDRX is enabled (eDRX checks every 60seconds). Like in the examples, a thread is polling the socket for POLLIN, POLLERR, POLLNVAL and POLLHUP events.
At app startup, everything is fine, i'm able to send and receive MQTT messages. But after some time of inactivity (device in idle, modem in idle for let's say, 10minutes), I can send messages from the device (QoS0) without errors, but messages never reach broker. Furthermore, none of the incoming messages are received by the device.
It seems like the connection is dropped at some point but polling isn't able to notice it.
Am I missing something ? Do I need to set a specific configuration on the socket ?
Thanks
Parents
  • I went down this path recently - contacting different brokers (HiveMQ, AWS, nrfCloud). While the broker may support keepalive times past 12 hours, the limitation is the load balancers and other underlying TCP connection settings. This limits MQTT KA to something like 30 minutes for practical usage (for all major brokers I talked to) unless you set up your own custom broker hosted on a machine that won't break the TCP connection. Try backing off to a keepalive time of ~1700 seconds maximum.

Reply
  • I went down this path recently - contacting different brokers (HiveMQ, AWS, nrfCloud). While the broker may support keepalive times past 12 hours, the limitation is the load balancers and other underlying TCP connection settings. This limits MQTT KA to something like 30 minutes for practical usage (for all major brokers I talked to) unless you set up your own custom broker hosted on a machine that won't break the TCP connection. Try backing off to a keepalive time of ~1700 seconds maximum.

Children
No Data
Related