MQTT newbie here
Developing on .NET with MqttNet library for EMQX broker:
I am using MQTTv5 feature 'user properties' to add a timestamp to my messages when published. That is working flawlessly.
However, I need to stamp the LWT messages too. In my connect method, I can supply an LWT including the timestamp user property. Now, when I subscribe to my LWT topic using MQQTX desktop client; I get those messages and LWTs; so far so good.
But when I terminate my programs process (by that, disconnect ungracefully); I immediately get an LWT message. The problem being that my 'timestamp' user property has the stamp from when the connection was established (and LWT first set).
I could leave the value empty in my connect-method, so empty value = ungraceful disconnect; but thats not very elegant
Is there a possibility to intercept LWT messages sent from the broker, and set the timestamp?
EDIT:
I found the 'rules engine', it letting me use a broker-timestamp. But I could only add it to the payload so far (optimally it would be a user property)