You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: You may remove this section prior to submitting your report.
A small team of volunteers monitors issues. Please help us to help you by making it simple to understand and, if possible,
replicate your issue. Prior to reporting a bug please:
It is acceptable to firstly launch event loop before connecting.
Connect to a remote broker. This is a blocking call that establishes the underlying connection and transmits a CONNECT packet. Note that the connection status will not be updated until a CONNACK is received and processed (this requires a running network loop, see loop_start, loop_forever, loop…).
But according to examples (like client_sub ) the order is opposite.
PierreF
changed the title
Loop could not be started before connecting to server. (inconsistiency in docs)
Subscription could be lost if loop is started before connecting to server. (inconsistiency in docs)
Apr 29, 2024
I reproduce your issue and this should either be fixed in code (preferred) or documented.
I've updated the title, since starting the loop before work and the connection works (cf your reason_code: Success message) but the subscribe() is indeed lost. You should be able to see that subscribe() is lost because it return an error (but no example show error checking).
Regardless of this bug, it might be preferable to subscribe in the on_connect callback to be sure your subscription is kept in case of reconnection (I'm not sure the broker had to persist them, especially when clean_session is True - the default). e.g.
Prerequisites
Note: You may remove this section prior to submitting your report.
A small team of volunteers monitors issues. Please help us to help you by making it simple to understand and, if possible,
replicate your issue. Prior to reporting a bug please:
to confirm the issue is specific to this client.
Bug Description
According do docs:
It is acceptable to firstly launch event loop before connecting.
But according to examples (like client_sub ) the order is opposite.
When I tried to start loop before connecting I had problems with connection and with subscription.
Reproduction
/logs
using tool like MQTTXReplacing order in this code
Fixes the issue:
Environment
Logs
The text was updated successfully, but these errors were encountered: