By using AWS re:Post, you agree to the Terms of Use
/MQTT Connection keeps getting disconnected/closed while publishing or subscribing to topics using LTE Modem/

MQTT Connection keeps getting disconnected/closed while publishing or subscribing to topics using LTE Modem

0
  • I'm using Quectel modem BG95 with a host MCU to connect to AWS IoT core and publish to topics and subscribe to topics as well.
  • I used to get an error occasionally that closed the MQTT connection exactly while doing pub/sub operations and connection had to be re-established , but that was very rare.
  • However, since the last few days I have been running tests on multiple devices (using same IoT core endpoint) and have been getting this MQTT dis-connection on each pub or sub operation. I am attaching a log for review.
  • To me it seems a server side issue since I have tried it with multiple modems and previous versions of firmware.
[While publishing to topic]

;2022-05-08T02:29:41Z;28;-966233403;462863960;;RAK000121|-45,RAKTEST|-56

AT+QIDEACT=1
OK[ 2022-05-08T02:29:41Z ] [FARM_IP][INFO] MDM_SET_DEACTIVATE_PDP-else


AT+QIACT=1
OK
AT+QMTOPEN=0,"a5u9klmd2viw3z-ats.iot.us-west-1.amazonaws.com",8883
OK

+QMTOPEN: 0,0		           --- [Opening MQTT Connection]
[ 2022-05-08T02:29:41Z ] [FARM_IP][INFO] Mqtt opened
AT+QMTCONN=0,"0123qwer786"
OK

+QMTCONN: 0,0,0                            --- [MQTT client connected]
AT+QMTPUB=0,1,1,0,"fm/1011",72        --- [Publishing to the MQTT Topic]

> ;2022-05-08T02:29:41Z;28;-966233403;462863960;;RAK000121|-45,RAKTEST|-56
OK

+QMTSTAT: 0,1    			 --- [MQTT Connection Closed]
[While Subscribing to topic]

AT+QMTSUB=0,1,"imei/get_logs",0			--- [Subscribing to the MQTT Topic]
OK

+QMTSTAT: 0,1					--- [MQTT Connection Closed]
[  ] [FARM_IP][INFO] Starting timer
AT+QMTSUB=0,1,"imei/get_logs",0			--- [Subscribing to the MQTT Topic]
OK
	
+QMTSTAT: 0,1					--- [MQTT Connection Closed]	
1 Answers
0

When you client is disconnected while publishing or subscribing the reason might be the IoT policy that is used. If you are not allowed to publish or subscribe to a topic your client is being disconnected.

You can use CloudWatch logs to drill down this error further. If the IoT policy is the reason you will find an authorization error in CloudWatch logs.

KR,

Philipp

answered 20 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions