I got an understanding of why MQTTv5 Message Expiry which might help prevent retaining stale messages that might not reach the dedicated client. However I am not sure if I understand Session Expiry that well, however I feel like it is the mechanism I want.
Is there a way for an MQTT client to disconnect from the broker gracefully after waiting for a fixed time interval and having not received a message on the subscribed topic?
I understand that an abrupt disconnect from a publishing client can lead to a Last Will and Testament Message / Topic triggering, which I can leverage in my application to successfully disconnect from the broker. Or the usage of
keepAlive mechanism might be able to keep the session on-going between the broker and clients.
However in a situation where something goes haywire (firmware glitch) where the MQTT publisher still maintains the session but no data is published, how can the subscriber decide that after having waited for a fixed time interval it is time to disconnect from the broker since there is no data coming in on the subscribed topic?
Would something like setting:
cleanStart=false on the subscriber actually be able to achieve this?