I have a subscriber and a publisher connected to broker. I am seeing following behaviour when i make the subscriber client link down and up.
keep alive time: 10 mins
1. subscriber to broker link goes down
2. publisher is still publishing msgs.
3. subscriber link comes up after 5 mins and it does a send__connect.
4. broker doesn't do CONNACK to subscriber yet.. it waits for keep alive timer to expire which is 10x1.5=15mins.
5. After 15 mins, broker sends LWT message to publisher and immediately does CONNACK 0 to subscriber.
6. subscriber subscribes to topic and it starte receiving old messages which were published by publisher at step 2.
subscriber and broker connection reconnects with cleanSession flag true and msgs on topic are with retain flag false, qos = 0.
Is this behaviour expected ? My requirement is to get latest msg after subscriber reconnects. Also When subscriber reconnects, is there
any way to connect it with broker immediately rather than waiting for keep alive timer to expire.
Any help is appreciated.
Thanks....