# MQTT client AT commands Source: [https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html) Table : MQTT client AT commands | Command | Description | | --- | --- | | [AT+MQTTINIT](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html#Toc185621689) | Set MQTT session init configuration | | [AT+MQTTCONN](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html#Toc184732455) | Query/set MQTT client connect session | | [AT+MQTTSUB](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html#Toc184732456) | Subscribe to an MQTT topic. | | [AT+MQTTPUB](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html#Toc184732457) | Publish an MQTT message | | [AT+MQTTPUBRAW](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html#Toc184732458) | Publish a long MQTT message | | [AT+MQTTUNSUB](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html#Toc184732459) | Unsubscribe from an MQTT topic | | [AT+MQTTDISCONN](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html#Toc184732460) | Close an MQTT connection | | [AT+MQTTDESTROY](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html#Toc184732461) | Destroy an MQTT session | | [AT+MQTTMODE](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html#at_mqttmode) | Set MQTT receiving mode | ## AT+MQTTINIT Source: [https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html) This command sets the MQTT session init configuration ### Operation type Set ### Syntax | Command | Response | | --- | --- | | AT+MQTTINIT | +MQTTINIT=<session\_id>,<TCP|SSL>[,<"ca\_file">,<"cert\_file">,<"key\_file">]



SSL without ca\_file: encrypted but no broker verification



OK | | AT+MQTTINIT=<session\_id>,<TCP|SSL>[,<"ca\_file">,<"cert\_file">,<"key\_file">] | +EVT:MQTT\_INITED:<session\_id>



OK | ### Defined values - ``: MQTT session ID: `0`, `1` - ``: Transport scheme: TCP or SSL - `<"cert_file">`: The file path of the certificate - `<"key_file">`: The file path of the private key - `<"ca_file">`: The file path of the CA used by the client to verify the server Note: See [AT+HTTPSSLCFG](https://docs.qualcomm.com/doc/80-Y8730-7/topic/http_client_at_commands.html#at_httpsslcfg) for how to flash certificate files. ## AT+MQTTCONN Source: [https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html) This command queries or sets the MQTT client connect session. ### Operation type Query/Set/Execution ### Syntax | Command | Response | | --- | --- | | AT+MQTTCONN | +MQTTCONN=<session\_id>,<"host">,<port>,<clientid>,<username>,<password>,<keepalive>,<clean session>



OK | | AT+MQTTCONN? | +MQTTCONN:<session\_id>,<state>,<transport scheme>,<"host">,<port>



OK | | AT+MQTTCONN=<session\_id>,<"host">,<port>,<clientid>, <username>,<password>,<keepalive>,<clean session> | +EVT:MQTT\_CONNECTED:<session\_id>,<transport scheme>,<"host">,<port>,<reconnect> | ### Defined values - ``: MQTT session ID: `0`, `1` - `<"host">`: The name of the host to be connected, can be URL path or IP address - ``: The port number to connect - ``: Client ID string for MQTT client - ``: Username to be used to connect to the server - ``: Password to be used to connect to the server - ``: Keep-alive seconds, default: 60s - ``: Whether to establish a new, clean session or resume a previous session, default: 0 - ``: MQTT connection state: - `0`: MQTT\_INIT - `1`: MQTT\_CONNECTED - `2`: MQTT\_DISCONNECT - `3`: MQTT\_FORCE\_DISCONNECT - ``: Transport scheme: TCP or SSL - ``: Whether reconnect when MQTT runs, default: 1 ## AT+MQTTSUB Source: [https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html) This command subscribes to an MQTT topic. ### Operation type Query/Set/Execution ### Syntax | Command | Response | | --- | --- | | AT+MQTTSUB | +MQTTSUB=<session\_id>,<"topic">,<qos>



OK | | AT+MQTTSUB=<session\_id>,<"topic">,<qos> | If successful, return:


+MQTTSUB=<session\_id>,"topic",<qos>


OK





If receive subscribed topics, return:

+EVT:MQTT\_SUBRECV:<session\_id>,<"topic">,<len>,<message> | | AT+MQTTSUB? | +MQTTSUB:<session\_id>,<state>,<"topic">,<qos\_level> | Note: Each session allows a maximum of 10 subscribed topics. ### Defined values - ``: MQTT session ID - `<"topic">`: The MQTT topic to subscribe to - ``: Quality-of-service level to use, range: 0–2, default: 0 - ``: Received payload length - ``: Received payload string - ``: MQTT connection state: - `0`: MQTT\_INIT - `1`: MQTT\_CONNECTED - `2`: MQTT\_DISCONNECT - `3`: MQTT\_FORCE\_DISCONNECT ## AT+MQTTPUB Source: [https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html) This command publishes an MQTT Messages in string. ### Operation type Set/Execution ### Syntax | Command | Response | | --- | --- | | AT+MQTTPUB | +MQTTPUB=<session\_id>,<"topic">,<qos>,<"message">,<retain>



OK | | AT+MQTTPUB=<session\_id>,<"topic">,<qos>,<"message">,<retain> | +EVT:MQTT\_PUBSUC:<session\_id>,<len>,<transport scheme>,<"host">,<port>



+EVT:MQTT\_PUBFAIL:<session\_id>,<scheme>,<"host">,<port> | ### Defined values - ``: MQTT session ID - `<"topic">`: The MQTT topic to publish to - ``: Quality-of-service level to use, range: 0–2, default: 0 - `<"message">`: Message string payload to send - ``: Message should be retained, default 0. - ``: The total data length to send - ``: Transport scheme: TCP or SSL - `<"host">`: The name of the host to be connected, can be URL path or IP address - ``: The port number to connect ## AT+MQTTPUBRAW Source: [https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html) This command publishes a long MQTT message. ### Operation type Set/Execution ### Syntax | Command | Response | | --- | --- | | AT+MQTTPUBRAW | +MQTTPUBRAW=<session\_id>,<"topic">,<length>,<qos>,<retain> | | AT+MQTTPUBRAW=<session\_id>,<"topic">,<length>,<qos>,<retain> | In data mode,

  • The following is printed when all data is sent:

    +EVT:MQTT_PUBSUC:<session_id>,<len>,<transport scheme>,<"host">,<port>




  • The following is printed if any data block fails to be sent:

    +EVT:MQTT_PUBFAIL:<session_id>,<scheme>,<"host">,<port>




| ### Defined values - ``: MQTT session ID - `<"topic">`: The MQTT topic to publish to - ``: The length of message string to be sent in data mode. After this command, the device prints `>` and then enters data mode to send data. The device automatically exits the data mode when all the data is sent or receives the `+++` command. - ``: Quality-of-service level to use, range: 0–2, default: 0 - ``: Message should be retained, default 0. - ``: The total data length to send - ``: Transport scheme: TCP or SSL - `<"host">`: The name of the host to be connected, can be URL path or IP address - ``: The port number to connect ## AT+MQTTUNSUB Source: [https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html) This command unsubscribes from an MQTT topic. ### Operation type Set/Execution ### Syntax | Command | Response | | --- | --- | | AT+MQTTUNSUB | +MQTTUNSUB=<session\_id>,<"topic">



OK | | AT+MQTTUNSUB=<session\_id>,<"topic"> | +EVT:MQTT\_UNSUBSUC:<session\_id>,<"topic">



+EVT:MQTT\_UNSUBFAIL:<session\_id>,<"topic"> | ### Defined values - ``: MQTT session ID - `<"topic">`: The MQTT topic to unsubscribe from ## AT+MQTTDISCONN Source: [https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html) This command closes an MQTT connection. ### Operation type Set/Execution ### Syntax | Command | Response | | --- | --- | | AT+MQTTDISCONN | +MQTTDISCONN=<session\_id>



OK | | AT+MQTTDISCONN=<session\_id> | +EVT:MQTT\_DISCONNECTED:<session\_id> | ### Defined values ``: MQTT session ID ## AT+MQTTDESTROY Source: [https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html) This command destroys an MQTT session. ### Operation type Set/Execution ### Syntax | Command | Response | | --- | --- | | AT+MQTTDESTROY | +MQTTDESTROY=<session\_id>



OK | | AT+MQTTDESTROY=<session\_id> | +EVT:MQTT\_DESTROYED:<session\_id> | ### Defined values ``: MQTT session ID ## AT+MQTTMODE Source: [https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-7/topic/mqtt_client_at_commands.html) This command sets MQTT receiving mode to hexadecimal/string mode. ### Operation type Set/Execution ### Syntax | Command | Response | | --- | --- | | AT+MQTTMODE | +MQTTMODE=<0|1: string|hex>



OK | | AT+MQTTMODE =<0|1: string|hex> | OK



Note:

If the flag is set to 1, the format of `+EVT:MQTT_SUBRECV` will be changed to `+EVT:MQTT_SUBRECVHEX:,<"topic">,,` | ### Defined values - ``: MQTT session ID - `<"topic">`: The MQTT topic to subscribe to - ``: Received payload length - ``: Received hexadecimal payload Last Published: Jul 30, 2026 [Previous Topic TCPIP AT commands](https://docs.qualcomm.com/bundle/publicresource/80-Y8730-7/topics/tcpip_at_commands.md) [Next Topic HTTP client AT commands](https://docs.qualcomm.com/bundle/publicresource/80-Y8730-7/topics/http_client_at_commands.md)