espressif / esp-aws-iot

AWS IoT SDK for ESP32 based chipsets
Apache License 2.0
256 stars 154 forks source link

AWS IoT sometimes unable to reconnect (CA-239) #136

Open tobyloki opened 1 year ago

tobyloki commented 1 year ago

I've bene using the thing shadow example based on https://github.com/espressif/aws-iot-device-sdk-embedded-C/tree/release-v3.1.x. Sometimes the device disconnects from AWS and is unable to reconnect even though there is wifi and internet available. It gives out the error NETWORK_ATTEMPTING_RECONNECT. What can I do to make sure the device always reconnects back to AWS?

law-ko commented 1 year ago

I also have the same issue even with the ota_mqtt demo project, any way to resolve this?

SolidStateLEDLighting commented 1 year ago

If you disconnect, then I suggest you do a full shutdown of the TLS/MQTT connection, then restart if Wifi/SNTP is still connected and valid.

Be sure that you're always going through MQTT_ProcessLoop when you are idle and doing nothing because MQTT_ProcessLoop initiates/handles your PING/PINGRESP. If you're not continuously moving through MQTT_ProcessLoop, then your connection will get dropped.