Questions about mqtt

I’ve been working on a cloud database system using mqtt but I ran into a road block
what I need to know is how to recover a message from mqtt after it’s been published

Depends. What do you need? You want to know when a message is being sent to the MQTT Server, or do you want to know WHAT the Message is? (If it's the latter option, then we can't help you, because it's practically impossible to send exact messages through MQTT or something)

But, who am I to correct others? I'm still a beginner to this MQTT stuff. And here you are, you've made a Cloud Clicker that resets the score every time someone joins in the game, and guess what? IT WORKS.

i know how to make it keep a message in mqtt until it is overriden but i can't figure out how to get that message back

When you subscribe to a topic, the last message, if marked as "retained", is immediately delivered to you.

Mqtt is not for cloud storage. It just won't work like you'd expect it to.

To expand on the FAQ info

This shows that if you subscribe to a topic, and then publish to that topic normally - you'll receive the message
mqttSubOrderRetained script pic

This shows that if you publish to a topic and THEN subscribe - you won't get any messages that have been published before you subscribed
mqttSubOrderRetained script pic (1)

And this shows that if publish to a topic with the retain flag set to true, then you will get that message even if you subscribe later.
mqttSubOrderRetained script pic (2)

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.