Meaning
Configuration parameters set within the connection header of a telemetry protocol manage the persistence of a session between the client and the broker. The mqtt keep alive value defines the maximum time allowed between communications before the broker assumes the client is offline. This timer is reset every time the client sends any packet, including a dedicated ping request.
Timing Interval
Client devices must send a packet within the specified window to prevent the server from closing the socket. The mqtt keep alive duration is chosen to balance the need for quick failure detection against the desire to save battery power.
Power State
Long intervals allow the radio hardware to remain in a sleep mode for extended periods between transmissions. If the mqtt keep alive is set too short, the device will wake up frequently just to maintain the connection, which depletes the battery. Balancing this interval requires knowledge of the network’s own timeout settings for inactive connections.
Link Reliability
Detection of a broken connection happens more quickly when the timer is set to a lower value. An mqtt keep alive ensures that the broker can release resources and notify other subscribers if a device loses power or signal. The connection is considered closed if no message is received within one and a half times the keep alive interval.