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]
asked 21 days ago25 views
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
Relevant questions
Problem with Ingestion data from IoT Core (MQTT) to AWS SiteWise
asked 5 months agocom.aws.greengrass.mqttclient.AwsIotMqttClient: Unable to connect to AWS IoT Core
Accepted Answerasked 5 months agoUsing MQTT Bridge and MySensors - getting started
asked a year agoHow can I restrict certain topics when not using AWS Cognito?
asked 2 years agoPublishing messages to IoT core using an imported lambda in greengrassv2
asked 2 months agoMQTT Connection keeps getting disconnected/closed while publishing or subscribing to topics using LTE Modem
asked 21 days agoIoT Core Can Connect, Can Subscribe, Can Not Publish
asked 3 years agoSet up IOT with MQTT?
asked 3 months agoDevices can't connect to IoT Core
Accepted Answerasked 5 months agounable to Sub scribing with Mqtt data in AWS IoT core with greengrass deployment
asked a month ago
What is the payload size you are publishing? Have you enabled CloudWatch logging on the AWS IoT side? What do they tell? What is the disconnection reason you get on the disconnect Lifecycle events? (https://docs.aws.amazon.com/iot/latest/developerguide/life-cycle-events.html)