I have gone through your documentation but really confused with Clean Session and Retain message,
What is the difference between Clean Session and Retain message?
I am using MQTTnet library, Retain message works but Clean Session does not work as mentioned in HiveMQ documentation. Please assist.
Hey @girishgsv ,
Please provide the link and the quote from the documentation that you don’t understand
Thanks,
Dasha from HiveMQ team
Both clean session and Retain flag retains the messages and delivers the messages as soon as client comes online or subscribes. Please help me understand the difference.
see the links and quotes below,
- When the clean session flag is set to false, the broker creates a persistent session for the client. All information and messages are preserved until the next time that the client requests a clean session. If the clean session flag is set to false and the broker already has a session available for the client, it uses the existing session and delivers previously queued messages to the client.
A retained message is a normal MQTT message with the retained flag set to true. The broker stores the last retained message and the corresponding QoS for that topic. Each client that subscribes to a topic pattern that matches the topic of the retained message receives the retained message immediately after they subscribe. The broker stores only one retained message per topic
Hi dear,
cleanStart is a CONNECT packet option:
When cleanStart=true, the client will not receive retained message on the topic it subscribes to.
When cleanStart=false, the client will receive the retained message.
retain is a PUBLISH packet option:
When retain=true, the message will be retained. When retain=false the message will not be retained.
We strongly advise to go through our course called “MQTT Essentials” to get a better understanding of MQTT features. Go though “MQTT5 Essentials” course to learn more about MQTT5 features.
I hope this helps,
Regards,
Dasha from HiveMQ team