njouanin / hbmqtt

MQTT client/broker using Python asynchronous I/O
MIT License
800 stars 188 forks source link

No more reconnects causes api calls remains blocked #140

Closed rkojedzinszky closed 6 years ago

rkojedzinszky commented 6 years ago

When connecting to a broker with auto_reconnect=False, after a successful connection and just a simple loop such as below will hang forever when the broker disconnects:

cl = MQTTClient(config={'auto_reconnect':False})
await cl.connect('mqtt://localhost')
while True:
  await cl.publish('topic', b'payload')
  await asyncio.sleep(1)