Search code examples
androidprotocolsmqttpaho

Change the last will and testament topic or payload after connection


I'm aware of how to set the "Last Will and Testament" before you make a connection and the server publishes that topic/payload when the client has an unexpected disconnection.

My question is regarding if it is possible to change the MQTT topic or payload of the last will and testament during a session (without forcing a reconnect).

I'm using the Java Paho client on Android if that makes any difference.


Solution

  • No it is not possible to change the Last Will and Testement because this data is only sent in the connect packet.

    This is described in the spec here: http://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html#_Toc398718028