IoT device
pump-7 connects with a Will Message and then publishes an online birth message.
Trace when an MQTT broker publishes a stored Will Message and when it must cancel it.
Trace the Will Message stored during CONNECT, then compare normal DISCONNECT, network failure, keep-alive timeout, MQTT 5 disconnect-with-will, and delayed reconnect cancellation.
pump-7 connects with a Will Message and then publishes an online birth message.
The device is connected and sending MQTT control packets within the Keep Alive window.
The broker stores the Will Message from CONNECT and clears it only when protocol rules say it should.
No Will Message is published while the connection is healthy.
Dashboards subscribe to devices/+/status and currently see pump-7 as online.
Step through CONNECT, birth message, fault, detection, delay, and subscriber update.
The broker stores the Will Message during CONNECT. Because the client is still connected, subscribers should see the retained birth message instead of the offline will.
The server is allowed to close the connection if it does not receive MQTT control packets within one and a half times the Keep Alive interval. The will is considered after that close plus any Will Delay.
A retained online birth message followed by a retained offline will is a common presence pattern. The will retain flag controls whether new subscribers see the offline state later.
The Will Message uses its configured QoS when the broker publishes it. QoS can affect acknowledgments and duplicates, but it does not make presence detection instantaneous.