0
votes

I am unable to find examples online on how to use cleanSession flag or retain flag in both publish and subscribe for mqtt aws sdk in JS. I know, that the python SDK has cleanSession flag. Is there such a flag available for the JS sdk? I have scanned through the code repo and I couldn't find any such flag. Could anyone please guide me. This is the code repo: https://github.com/aws/aws-iot-device-sdk-js

I have a publisher publishing messages to topics to the AWS broker and a subscriber subscribed to those topics to receive those messages. If a subscriber joins late, I want the subscriber to get the last message which the publisher had sent to the topics. This is the reason I want to use persistent sessions, for which I believe I have to set the cleanSession flag to false.

Could anyone please give me an example on how to use the flag for the JS sdk?

1
I can't seem to find the cleanSession flag in the python SDK. Can you point me to it? ThanksPhil R

1 Answers

0
votes

The AWS-IOT MQTT broker does not support retained messages.

It also only supports QOS 0 and 1 (not 2)

You can see the restrictions on the AWS-IOT broker here