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?