Overview - MQTT keep-alive and timeout
What is it?
MQTT keep-alive is a timer that a client sets to tell the broker how often it will send a message to show it is still connected. If the broker does not hear from the client within this time plus a small grace period, it assumes the client is gone and closes the connection. Timeout is the period after which the broker decides the client is no longer active if no messages or pings are received.
Why it matters
Without keep-alive and timeout, the broker would not know if a client has disconnected unexpectedly, leading to wasted resources and stale connections. This can cause delays in message delivery and reduce the reliability of IoT systems that depend on MQTT for real-time communication.
Where it fits
Learners should first understand basic MQTT concepts like client, broker, and message flow. After grasping keep-alive and timeout, they can learn about MQTT Quality of Service levels and session persistence to build robust IoT communication.