Issue connecting with MQTT server

Hello sir,
I am using M66DS for connecting to MQTT server. I have tried with MC60 module too, but i am not able to connect with MQTT Server. I have attached detailed log here:

AT

OK

ATE0

OK

SMS Ready

AT+IPR=9600

OK

AT+CPIN?

+CPIN: READY

OK

AT+CREG?

+CREG: 0,1

OK

AT+CMGF=1

OK

AT+QIFGCNT=0

OK

AT+QICSGP=1,“internet”,"",""

OK

AT+QIMUX=0

OK

AT+QIMODE=0

OK

AT+QINDI=1

OK

AT+QIDNSIP=0

OK

AT+QIREGAPP

OK

AT+QIACT

OK

AT+CGATT=1

OK

AT+QINDI=1

OK

AT+CSQ

+CSQ: 24,0

OK

ATE0

OK

AT

OK

AT+QISTAT

OK

STATE: IP GPRSACT

AT+QISTAT

OK

STATE: IP GPRSACT

OK

STATE: IP GPRSACT

AT+QISTAT

OK

STATE: IP GPRSACT

OK

STATE: IP GPRSACT

OK

STATE: IP GPRSACT

AT+QIOPEN=“TCP”,“rms1.kusumiiot.co”,1883

OK

OK

OK

OK

OK

AT

OK

AT+CSQ

+CSQ: 21,0

OK

AT+QISTAT

OK

STATE: TCP CONNECTING

AT+QISTAT

OK

STATE: TCP CONNECTING

OK

STATE: TCP CONNECTING

AT+QISTAT

OK

STATE: TCP CONNECTING

OK

STATE: TCP CONNECTING

OK

STATE: TCP CONNECTING

AT+QISTAT

OK

STATE: TCP CONNECTING

AT+QIOPEN=“TCP”,“rms1.kusumiiot.co”,1883

OK

CONNECT FAIL

AT+QIOPEN=“TCP”,“rms1.kusumiiot.co”,1883

OK

CONNECT FAIL

AT+QIOPEN=“TCP”,“rms1.kusumiiot.co”,1883

OK

CONNECT FAIL

Please help me with this.
Thank You.

Hi Virendra
Thanks for your query.
please find the attached MQTT application note. please refer the example from attached application noteQuectel_GSM_MQTT_Application_Note_V1.2.pdf (518.0 KB)

Hello Rahul,
Thank you for quick reply.
I am connecting to non SSL server. I have tried following things:

AT

OK

ATE0

OK

SMS Ready

AT+IPR=9600

OK

AT+CPIN?

+CPIN: READY

OK

AT+CREG?

+CREG: 0,1

OK

AT+CMGF=1

OK

AT+QIFGCNT=0

OK

AT+QICSGP=1,“internet”,"",""

OK

AT+QIMUX=0

OK

AT+QIMODE=0

OK

AT+QINDI=1

OK

AT+QIDNSIP=0

OK

AT+QIREGAPP

OK

AT+QIACT

OK

AT+CGATT=1

OK

AT+QINDI=1

OK
AT+QMTCFG=“ALIAUTH”,0,“oyjtmPl5a5j”,“MQTT_TEST”,“wN9Y6pZSIIy7Exa5qVzcmigEGO4kAazZ”

OK

AT+QMTOPEN=0,“rms1.kusumiiot.co”,1883

OK

+QMTOPEN: 0,-1

AT+QMTOPEN=0,“rms1.kusumiiot.co”,1883

OK

+QMTOPEN: 0,-1

I still cant connect to server.

Hi, virendra:

The above command statements need to be configured for your MQTT server, rather than copying the execution command in the instruction manual,This is a very important configuration parameter, if configured incorrectly the device will not be able to connect to the MQTT server.
First of all I don’t know if “rms1.kusumiot.co” supports MQTT service.It is suggested that you first go through the details of “rms1.kusumiot.co” regarding the MQTT aspect, especially for the device accessing its MQTT server.

//For example, the configuration parameters of MQTT service provided by OneNet platform of China Mobile are as follows: at+qmtcfg="onenet",0,"aTn09IUIH7","DdWRO03xGUnVGYVhkWnpF3P9IW3Hmx0JT5/PW8FJ/as="
//at+qmtcfg=“MQTT service provider”,0,“ProductID”,“DeviceKEY”

Please know or consult the MQTT service provided by “rms1.kusumiot.co” at first, especially regarding the connection of the device to his MQTT server.
Maybe this problem is complicated, you can try the advice I gave you first, if there are other questions, we will keep communicating, thank you!

Hello sir,
Thank you for clarifications on that command. However, what if i don’t have any productID or deviceKey for my MQTT server. Also, i want to know if these command necessary to configure ?

rms1.kusumiiot.co” is my own server, it support MQTT as well as SSL.This server has a private username, clientID and password for connection. Can you guide me with this process?

Thank You.

Hi,virendra:
If you already have set up your own MQTT server on your host/computer, I assume that your MQTT server is not recognized on the external/public network,The module can connect to the external/public network over a radio network, but it can’t communicate with your private network.In other words, the MQTT server you have personally established is not publicly published and the module cannot establish a connection with your server,I personally believe that the module is not able to access your personal MQTT server through AT Command,However, I found through the Internet that the MQTT server state you built can be detected by the MQTT. FX software.
So, I personally seggust that you get a public MQTT server to test the module.as (aliyun.com)](https://iot.console.aliyun.com/lk/summary/new)
If there are any other questions, we will keep in touch and discuss. Thank you!

Helllo sir,
This server is completely public. I can connect with all available public mqtt clients softwares using non SSL port and also with SSL port. I can also able to send as well as receive data through this server. I have no doubt regarding that server,

Hi virendra:


If you are using AT Command to connect the MC60 to the MQTT server,The above parameter configuration is certainly essential,But our first parameter is currently configured as “ALIAUTH” by default,so I am also not sure if it is valid to connect to the MQTT server based on your authentication parameters (product_key,device_name,device_secret),You can also try it(the first parameter is configured as “aliauth” or something else).
In addition,You can also try changing “rms1.kusumiot.co” to an IP address accessible to the external network,as:

AT+QMTOPEN=0,“iot-as-mqtt.cn-shanghai.aliyuncs.com”,1883

Equivalent to:

AT+QMTOPEN=0,“139.196.135.135”,1883

Also change your first parameter “TCP” to"0".

I hope you can solve your problem. If the problem still exists, we will keep communicating. Thank you!

Hi Virendra
I have tested you mqtt broker with MQTT.fx tool it is not connecting
please refer below images make sure broker is working

Hello sir,
Thank you for reply. I have successfully connected this server using MC60 as well as M66 DS. It was problem with sim card, sim card has some limited ports allowed, i have tried with open sim card and its now connected.

However I have not used QMQTTOPEN commands instead of i have tried QSSLOPEN commands as per attached Quectel_GSM_SSL_TCP_Application_Note_V3.2.pdf (473.3 KB) application notes.

Anyways, Thank you for all the support.

Dear Rahul,
There should be username and password needed for connection and you might need to change your clientid to some random characters.
Anyway my problem was solved with replacing my sim card.

Thank you for all the support.