The Mosquitto server I am testing with was closing the connection until I commented this line out.
Scenario:
The device using your GSM AT library connects successfully to MQTT broker - and subscribes to topic of interest
Keep-alive interval set to 30 seconds
Device does not publish on any topic
Another remote client connects to broker and publishes on topic of interest - so (in mqtt_recv_cb) device resets the keep-alive timer (client->poll_time)
The time between PINGREQ messages is then too long - so the server closes the connection
I don't think that the
client->poll_time
should be reset in themqtt_recv_cb()
: https://github.com/MaJerle/gsm-at-lib/blob/develop/gsm_at_lib/src/apps/mqtt/gsm_mqtt_client.c#L848 .The Mosquitto server I am testing with was closing the connection until I commented this line out.
Scenario:
mqtt_recv_cb
) device resets the keep-alive timer (client->poll_time
)PINGREQ
messages is then too long - so the server closes the connection