Ubidots Community

Lack of retained flag for MQTT on connection

Hello,

I am facing issue after switching to the STEM platform with the MQTT messages.
After reconnecting the device I got immediately messages for the subscribed topics, problem is that there is no “retained” option set in those messages.
On the education platform (before switching to the STEM) it was working correctly.

Generally subscription and publishing works correct, problem is only with those messages right after reconnecting that are “an update” while device was offline.

Greetings, at Ubidots all the messages published by MQTT are considered as retained always, even if you do not send this flag in your publish setup. If you were using an educational account and did not receive your published messages as if they were retained, this is certainly a bug that was not solved as the educational platform is no longer supported since a while ago.

This decision was taken after many feedback messages provided by our users that asked for this broker behavior and has been working as such since also a long time ago. If you wish to change this, feel free to contact support@ubidots.com, we have several plans that include custom MQTT brokers.

All the best

Thank you for the response.
I might be not clear enough, but for the educational platform this retained flag was working correct.
It seems not working on the STEM platform (flag “retained” is no longer set in received messages).

Greetings @Arek, as I posted previously, for both Industrial/STEM accounts, all the messages are set as retained, even if you do not send this flag in your message. This is the desired behavior set by us after some feedback taken by our users.

All the best

Hi jotathebest, thank you for confirmation that “retained” flag is set by default.
Problem is that it seems not set.
Here is example header of the MQTT message I receive:
30 88 01 00 1D…
As you can see the flags section is “0”, so no flags set.

Regards

Greetings, besides that you received a non-retained flag, our broker will always treat ALL the dots ingested through MQTT as retained, basically, we do not take care of this flag and always notifies values after a subscription to a topic for the first time.

All the best

So in summary, you do not send retained messages, as retained flag is not set. You just send last value after client reconnect, the same LIKE it would be retained message.
So it is kind of semi retained message.

I am not sure if “semi-retained” is the proper adjective, but yes, we always update any topic as if your values were published with the retained flag.

All the best