empicano / aiomqtt

The idiomatic asyncio MQTT client
https://aiomqtt.bo3hm.com
BSD 3-Clause "New" or "Revised" License
431 stars 77 forks source link

Do not send messages for a long time mqtt automatically disconnects #295

Closed 0716gzs closed 4 months ago

0716gzs commented 7 months ago

When I use aiomqtt to connect to mqtt after an hour without sending mqtt messages, the following error occurs: aiomqtt. exceptions.MqttCodeError: [code:16] Client or broker did not communicate in the keepalive interval.

However, I see the underlying default keepalive is 60. What is the reason for this

empicano commented 7 months ago

This exception is raised in the underlying paho-mqtt library and aiomqtt only propagates it in a custom exception. On first glance, we probably can't solve this inside aiomqtt, could you check the paho-mqtt project, maybe there's some info on this over there? This issue and this one seem related (code 16) for example.

empicano commented 4 months ago

I'll tentatively close this as there have been no further responses. If it is still a problem, please feel free to reopen! 🙂