MQTT what is the purpose or usage of Last Will Testament?

后端 未结 3 2074
伪装坚强ぢ
伪装坚强ぢ 2021-01-30 13:48

I\'m surely missing something about how the whole MQTT protocol works, as I can\'t grasp the usage pattern of Last Will Testament messages: what\'s their purpose?
O

3条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-30 14:36

    A in-depth article about Last-Will-and-Testament messages is available in the MQTT Essentials Blog Post series: http://www.hivemq.com/mqtt-essentials-part-9-last-will-and-testament/.

    To summarize the blog post:

    The Last Will and Testament feature is used in MQTT to notify other clients about an ungracefully disconnected client.

    MQTT is often used in scenarios were unreliable networks are very common. Therefore it is assumed that some clients will disconnect ungracefully from time to time, because they lost the connection, the battery is empty or any other imaginable case. It would be good to know if a connected client has disconnected gracefully (which means with a MQTT DISCONNECT message) or not, in order to take appropriate action.

提交回复
热议问题