N11 V2
AT Command Manual
Copyright © Neoway Technology Co., Ltd
106
Remarks
Before calling up this command, execute AT+IMQTTPARA to set MQTT
parameters.
16.5 Publishing a Message: +IMQTTPUB
Description
To publish a message
Format
AT+IMQTTPUB=<topcic>,<qos>,<message>,[format],[fragment_id]<CR>
Parameter
<Topic>: Topic to be published
<Qos>: QoS value, ranging from 0 to 2
<Message>: message to be published
[format]: message format
0: normal character strings
1: character string in hexadecimal format
Optional, the default value is 0
[fragment_id]: fragment ID of long message.
Optional, the default value is 0
Return Value
<CR><LF><CR><LF>+IMQTTPUB:<packet_id>
<CR><LF>OK<CR><LF>
Or
<CR><LF><CR><LF>+CME ERROR:<err><CR><LF>
If valid data is input, the module returns OK and then reports result in an unsolicited
manner.
<CR><LF><CR><LF>+IMQTTPUB:<packet_id>,<status><CR><LF>
<Packet_id>: packet ID returned after subscribing the message
<Status>: status returned after publishing the message
0: Successful
1: Timeout
2: Other errors
Example
AT+IMQTTPUB=“/test_topic_001”,1,“hellosim”
+IMQTTPUB:24761
OK
+IMQTTPUB:24761,0
Send a short message
Remarks
If some complexed messages are sent containing quotation marks or other