If you are asking a question, please follow this template:
- My goal is: Have my MQTT Broker publish a last will and testament message to specified topic.
- My actions are: I have set the topic and message (with qos1) on the client before connecting to the broker, connect to the broker, subscribe with a second client to the set Last Will Topic (qos1 as well), cut power to the client, wait…
- The result I see is: The LWT message is not published from the broker and the disconnect is never acknowledged.
- My expectation & question is: My expectation is to have the last will message published when disconnect happens.
I am maybe looking for an example of the MQTT Last Will and Testament feature. I seem to be doing something incorrectly and I’m not sure if I’m missing a step on the broker side.
Do I need to write code to handle an abrupt disconnect of an MQTT Client on the broker and publish the last will message accordingly, or will the broker take care of that situation already?
If anyone has an example or blog post on this topic it would be greatly appreciated.