问题
I'm trying to publish my data to Amazon web services using BG96 (NB-IoT device that use AT commands) I'm following the official documentation (Quectel) so I configure SSL parameters ( with the command : at+ qsslcfg=...) and start MQTT SSL connection successfully (AT+QMTOPEN=...) but when I try to connect to MQTT server( AT+QMTCONN=...), the connection is closed immediately Please help,how can I fix this problem and publish my data to Amazon web services ?
AT+QSSLCFG="ciphersuite",1,0x0035
OK
AT+QSSLCFG="sslversion",1,3
OK
AT+QSSLCFG="cacert",1,"ufs:cacert.pem"
OK
AT+QSSLCFG="clientcert",1,"ufs:clientcert.pem"
OK
AT+QSSLCFG="clientkey",1,"ufs:clientkey.pem"
OK
AT+QSSLCFG="seclevel",1,2
OK
AT+QSSLCFG="negotiatetime",1,300
OK
AT+QSSLCFG="ignorelocaltime",1,0
OK
//Configure MQTT session into SSL mode.
AT+QMTCFG=”SSL”, 0, 1, 1
//Start MQTT SSL connection
AT+QMTOPEN=0, "a2xxxxxxxxxzxx.iot.us-east-1.amazonaws.com",”8883”
OK // ok
+QMTOPEN: 0,0 // means the connction is starts succsesfully
//Connect to MQTT server
AT+QMTCONN=0,"bg96"
ok
+QMTSTAT 0,1 //but this message means that the connection is closed
回答1:
I had the same problem here with BG96, MQTTS over port 8883. My solution with this modem is to force the MQTT version to "v4", according to the AT MQTT Manual. So, after your AT+QMTCFG=”SSL”, 0, 1, 1, try using AT+QMTCFG="version",0,4, then open the connection and authenticate.
回答2:
I find the solution , My problem is that I should create a policy to allow connection to aws and attach this policy to the thing that I create , If nb-iot is used then we shoud configure the DNS address to Google public DNS : 8.8.8.8 and 8.8.4.4 And of course issue all commands attentively to update certificates , configure ssl context , activate tcp context and finally open mqtt connection and connect to publish or subscribe to topic
来源:https://stackoverflow.com/questions/55302178/error-when-publish-data-to-aws-iot-using-bg96-and-mqtt-protocol