My goal is:
To publish to mqtt broker retained message
My actions are:
Here is code snipped that I run on esp32 board according to this doc:
MQTT.pub(topic, data, 1, true); //true: retain flag
The result I see is:
Message is not retained as when the subscriber (Node.js app) is restarted the last message is lost. I played with clean session option on that client as well as with QOC options on both esp32 and client to no avail.
Also, I tried to subscribe for the same topic in node-red and see clearly in it’s debug console that that retain property is false. I’m using RabitMq mqtt broker.
My expectation & question is:
Message posted is to be retained on mqtt broker and client app will get it upon it’s restart. This is pretty straightforward code and I’m wandering if I’m missing something, if this is related to api_mqtt.js library or mqtt broker.
Does anyone has this issue with different mqtt broker?