N11 V2
AT Command Manual
Copyright © Neoway Technology Co., Ltd
99
Remarks
Topicname must be marked by quotation marks.
15.3 Connection Command: +MQTTCONN
Description
To connect to the MQTT server.
Format
AT+MQTTCONN=<”host”>,<clean>,<keep_alive><CR>
Parameter
<”Host”>: Server address (URL:port), the parameter must be marked by quotation
marks.
<clean>: whether to clean session, digit type, 0-Not clean; 1-Clean
0 by default
<Keep_alive>: keepAlive time, 60s by default
Return Value
<CR><LF>OK<CR><LF>
Example
AT+MQTTCONN="lixytest.mqtt.iot.gz.baidub
ce.com:1883",0,60
OK
Connect to the MQTT server
successfully.
Remarks
Host must be marked by quotation marks.
15.4 Subscription: +MQTTSUB
Description
To subscribe a topic
Format
AT+MQTTSUB=<”topicname”>,<qos><CR>
Parameter
<”topicname”>: Topic to subscribe to, the parameter must be marked by quotation
marks.
<Qos>: Quality of service
Return Value
<CR><LF>OK<CR><LF>
Example
AT+MQTTSUB="lixytopic",1
+MQTTSUB:2,"lixytopic",5,12345
OK
Subscribe to the topic successfully.
The server issues the message
with a retain mark of 1 of this topic.
AT+MQTTSUB="lixytopic",1
Subscribed
to
the
topic