eclipse / paho.mqtt.python

paho.mqtt.python
Other
2.17k stars 723 forks source link

Safeguard for subscribing to empty list of topics. #690

Closed peromvikgoodtech closed 7 months ago

peromvikgoodtech commented 1 year ago

I had an issue where I mistakenly called MqttClient.subscribe() with an empty list inside the on_connect() callback, as recommended in the docs. Instead of raising an error, the client disconnects and enters an indefinite reconnect loop.

Recommended fix: Assert non-emptiness of list passed to the subscribe method in MqttClient.

ralight commented 1 year ago

Thank you, I've fixed that.