MQTT Keep Alive feature ensures that the connection between the MQTT client and MQTT broker is still open and both the parties of aware of the  connection status.

Related Topics

When the MQTT client is not sending any message, it needs to send the PINGREQ message before the keep-alive interval expires. MQTT broker will respond with the PINGRESP message in one and half times the keep alive interval.

MQTT Server Log for Keep Alive

In the below log, MQTT client send the PINGREQ message to the MQTT broker every keep alive interval after the PUBLISH messages are sent. MQTT broker will acknowledge with the PINGRESP response.

1557618075: Received PUBLISH from 2481 (d0, q2, r0, m14, ‘SensorReadings’, … (19 bytes))
1557618075: Sending PUBREC to 2481 (m14, rc0)
1557618075: Received PUBREL from 2481 (Mid: 14)
1557618075: Sending PUBCOMP to 2481 (m14)
1557618135: Received PINGREQ from 2481
1557618135: Sending PINGRESP to 2481
1557618195: Received PINGREQ from 2481
1557618195: Sending PINGRESP to 2481

Keywords: Module , M2M , GPRS , 3G , through AT commands,