fizista / micropython-umqtt.simple2

MIT License
74 stars 35 forks source link

Active closure of socket upon reconnection #15

Closed elvis-epx closed 1 year ago

elvis-epx commented 1 year ago

This PR explicitly calls disconnect() before connect(), and makes sure disconnect() is idempotent and does nos raise exceptions.

At least in ESP32, connection sockets are limited in number (8 or 10) and they pile up if not explicitly closed and/or garbage-collected. Calling connect() a number of times on umqtt.simple or umqtt.simple2 without explicit closure/gc eventually fails.

fizista commented 1 year ago

Thank you.

dgoadby commented 1 year ago

Thanks from me too. I just ran into this problem.