Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.5.2
-
None
Description
If the client specifies `setCleanSession(true)` (or, if the broker has a low-enough `persistent_client_expiration` value), a QMqttSubscription will not survive a disconnect + reconnect cycle, even though its status never changes.
Since the subscription is owned by the QMqttClient (according to QMqttClient::subscribe() docs), I think that the QMqttClient should trigger something to transition the QMqttSubscription state to the "Error" state (or something).
Please see the attached project. As a work around, the manual "tear down subscription and recreate it" code block can be uncommented in helper.cpp.
Steps:
1) build
2) run
3) click anywhere in the app to trigger first-time-connection
4) wait for 12 seconds or so (you should see messages saying published+received values)
5) disable your wifi and wait until the app transitions to Disconnected state (takes ages - QtMqtt is not swift at noticing that the network has vanished - can this be fixed too?)
6) enable your wifi, and then either wait 20s for the automatic reconnect, or click in the app
7) wait for 12 seconds or so (but the bug is: this time we see published values, but no received values, unlike in step 4 where we see both increase)
Tested on Windows 11 with Qt 6.5.2.