Last will and testament

The Last Will and Testament (LWT) message is used if a client disconnects from a broker unexpectedly. An LWT message is set up and defined at the client side while connecting to the broker for the first time and gets stored at the broker. Whenever a client gets disconnected from the broker abruptly due to network issues or power loss, where the client doesn't get the chance to call the disconnect method to end the connection gracefully, the broker then sends the saved LWT message for that client to all its subscribers, informing them of the sudden unavailability of the client.

Get Internet of Things with Raspberry Pi 3 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.