I am using Quectel’s Mc60 module for GPRS connectivity and AWS IoT as MQTT broker.
I am using paho eclipse MQTT client and the connection is made using module SSL AT command.
I am able to connect to the broker and publish and subscribe but the client gets disconnected due to no ping response or response after keep alive interval (30s - I have also added a grace period of added 30 secs i.e. total wait period 60s). I have also tried making the connection in QOS1 but the publish response fails and client gets disconnected. I want to know is it because of network error or any other issue.
This can happen if your broker is not receiving the ping requests. Some brokers have timeouts and disconnect after certain period of inactivity.
Are you sending ping packets at regular intervals?
And you can also get disconnected if another client with same client ID as yours gets connected to broker. The broker disconnects the other duplicate connection.
I’m using paho’s embedded C client library and have checked that the ping request is send before the keep alive interval ends. Regarding similar client Id my micro controller has Random number generatorhardware for unique client ID on every connection.
As observed sometimes the Ping response is received very late.