Why does an AMQP client automatically go offline?
This topic describes the possible reasons why an AMQP client disconnects from IoT Platform and provides solutions.
Possible cause | Description |
Authentication timeout | You must send an authentication request immediately after establishing a connection. If authentication is not completed within 15 seconds, the server will close the connection. |
Data timeout | When a server connects to IoT Platform, set a heartbeat time using the `idle-timeout` parameter of the AMQP protocol. The value must be between 30 and 300 seconds. IoT Platform closes the connection if no frames are sent within this time. After connecting, send PING packets from the server within the heartbeat time to maintain the connection. IoT Platform disconnects the client if it does not receive a PING packet within this time. Note If you use the software development kit (SDK) provided by Alibaba Cloud, you do not need to send PING packets to maintain the connection. The SDK includes a keepalive heartbeat. Just ensure the main process continues to run. |
Connection limits | A consumer group allows a maximum of 100 connection requests per minute from consumer clients. Note A consumer client is the AMQP client that receives messages from IoT Platform. It is not the device. |
AMQP client reconnects after a device disconnects | When the IoT Platform server is published or restarted, it disconnects from devices. If a device reconnects successfully, it is normal for the AMQP client to also go offline and reconnect. Device messages are still pushed to the AMQP client and are not lost. |
Network issues | Network disconnections or network jitter. |
When you configure an AMQP client to connect to IoT Platform, the connection authentication logic must comply with the AMQP protocol and server-side limits. For more information, see AMQP client connection guide.
For more information about server-side limits, see Limits on server-side subscriptions.