# MQTT client AT commands

Source: [https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html)

Table : MQTT client AT commands

| Command | Description |
| --- | --- |
| [AT+MQTTINIT](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html#Toc185621689) | Set MQTT session init configuration |
| [AT+MQTTCONN](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html#Toc184732455) | Query/set MQTT client connect session |
| [AT+MQTTSUB](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html#Toc184732456) | Subscribe to an MQTT topic. |
| [AT+MQTTPUB](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html#Toc184732457) | Publish an MQTT message |
| [AT+MQTTPUBRAW](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html#Toc184732458) | Publish a long MQTT message |
| [AT+MQTTUNSUB](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html#Toc184732459) | Unsubscribe from an MQTT topic |
| [AT+MQTTDISCONN](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html#Toc184732460) | Close an MQTT connection |
| [AT+MQTTDESTROY](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html#Toc184732461) | Destroy an MQTT session |
| [AT+MQTTMODE](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html#at_mqttmode) | Set MQTT receiving mode |

## AT+MQTTINIT

Source: [https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html)

This command sets the MQTT session init configuration

### Operation type

Set

### Syntax

| Command | Response |
| --- | --- |
| AT+MQTTINIT | +MQTTINIT=&lt;session\_id&gt;,&lt;transport scheme&gt;<br><br><br>                <br>OK |
| AT+MQTTINIT=&lt;session\_id&gt;,&lt;transport scheme&gt;,&lt;"ca\_file"&gt;,&lt;"cert\_file"&gt;,&lt;"key\_file"&gt; | +EVT:MQTT\_INITED:&lt;session\_id&gt;<br><br><br>                <br>OK |

### Defined values

- `<session_id>`: MQTT session ID: `0`, `1`
- `<transport scheme>`: 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-10/topic/http_client_at_commands.html#at_httpsslcfg) for how to flash certificate files.

## AT+MQTTCONN

Source: [https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-10/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=&lt;session\_id&gt;,&lt;"host"&gt;,&lt;port&gt;,&lt;clientid&gt;,&lt;username&gt;,&lt;password&gt;,&lt;keepalive&gt;,&lt;clean session&gt;<br><br><br>                <br>OK |
| AT+MQTTCONN? | +MQTTCONN:&lt;session\_id&gt;,&lt;state&gt;,&lt;transport scheme&gt;,&lt;"host"&gt;,&lt;port&gt;<br><br><br>                <br>OK |
| AT+MQTTCONN=&lt;session\_id&gt;,&lt;"host"&gt;,&lt;port&gt;,&lt;clientid&gt;, &lt;username&gt;,&lt;password&gt;,&lt;keepalive&gt;,&lt;clean session&gt; | +EVT:MQTT\_CONNECTED:&lt;session\_id&gt;,&lt;transport scheme&gt;,&lt;"host"&gt;,&lt;port&gt;,&lt;reconnect&gt;<br><br><br>                <br>+EVT:MQTT\_DISCONNECTED:&lt;session\_id&gt;<br><br><br>                <br>+EVT:MQTT\_KEEPLIVETIMEOUT:&lt;session\_id&gt; |

### Defined values

- `<session_id>`: MQTT session ID: `0`, `1`
- `<"host">`: The name of the host to be connected, can be URL path or IP address
- `<port>`: The port number to connect
- `<clientid>`: Client ID string for MQTT client
- `<username>`: Username to be used to connect to the server
- `<password>`: Password to be used to connect to the server
- `<keepalive>`: Keep-alive seconds, default: 60s
- `<clean session>`: Whether to establish a new, clean session or resume a previous session, default: 0
- `<state>`: MQTT connection state:
    - `0`: MQTT\_INIT
    - `1`: MQTT\_CONNECTED
    - `2`: MQTT\_DISCONNECT
    - `3`: MQTT\_FORCE\_DISCONNECT
- `<transport scheme>`: Transport scheme: TCP or SSL
Note: SSL isn't supported yet. The default value is TCP.
- `<reconnect>`: Whether reconnect when MQTT runs, default: 1

## AT+MQTTSUB

Source: [https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html)

This command subscribes to an MQTT topic.

### Operation type

Query/Set/Execution

### Syntax

| Command | Response |
| --- | --- |
| AT+MQTTSUB | +MQTTSUB=&lt;session\_id&gt;,&lt;"topic"&gt;,&lt;qos\_level&gt;<br><br><br>                <br>OK |
| AT+MQTTSUB=&lt;session\_id&gt;,&lt;"topic"&gt;,&lt;qos\_level&gt;,&lt;"message"&gt;,&lt;retain&gt; | +EVT:MQTT\_SUBSUC:&lt;session\_id&gt;,&lt;"topic"&gt;<br><br><br>                <br>+EVT:MQTT\_SUBFAIL:&lt;session\_id&gt;,&lt;"topic"&gt;<br><br><br>                <br>+EVT:MQTT\_SUBALREADY:&lt;"topic"&gt;<br><br><br>                <br>+EVT:MQTT\_SUBRECV:&lt;session\_id&gt;,&lt;"topic"&gt;,&lt;len&gt;,&lt;message&gt; |
| AT+MQTTSUB? | +MQTTSUB:&lt;session\_id&gt;,&lt;state&gt;,&lt;"topic"&gt;,&lt;qos\_level&gt; |

Note: Each session allows a maximum of 10 subscribed topics.

### Defined values

- `<session_id>`: MQTT session ID
- `<"topic">`: The MQTT topic to subscribe to
- `<qos_level>`: Quality-of-service level to use, range: 0–2, default: 0
- `<len>`: Received payload length
- `<message>`: Received payload string
- `<state>`: 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-10/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html)

This command publishes an MQTT Messages in string.

### Operation type

Set/Execution

### Syntax

| Command | Response |
| --- | --- |
| AT+MQTTPUB | +MQTTPUB=&lt;session\_id&gt;,&lt;"topic"&gt;,&lt;qos\_level&gt;,&lt;"message"&gt;,&lt;retain&gt;<br><br><br>                <br>OK |
| AT+MQTTPUB=&lt;session\_id&gt;,&lt;"topic"&gt;,&lt;qos\_level&gt;,&lt;"message"&gt;,&lt;retain&gt; | +EVT:MQTT\_PUBSUC:&lt;session\_id&gt;,&lt;len&gt;,&lt;transport scheme&gt;,&lt;"host"&gt;,&lt;port&gt;<br><br><br>                <br>+EVT:MQTT\_PUBFAIL:&lt;session\_id&gt;,&lt;scheme&gt;,&lt;"host"&gt;,&lt;port&gt; |

### Defined values

- `<session_id>`: MQTT session ID
- `<"topic">`: The MQTT topic to publish to
- `<qos_level>`: Quality-of-service level to use, range: 0–2, default: 0
- `<"message">`: Message string payload to send
- `<retain>`: Message should be retained, default 0.
- `<len>`: The total data length to send
- `<transport scheme>`: Transport scheme: TCP or SSL
Note: SSL isn't supported yet. The default value is TCP.
- `<"host">`: The name of the host to be connected, can be URL path or IP address
- `<port>`: The port number to connect

## AT+MQTTPUBRAW

Source: [https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html)

This command publishes a long MQTT message.

### Operation type

Set/Execution

### Syntax

| Command | Response |
| --- | --- |
| AT+MQTTPUBRAW | +MQTTPUBRAW=&lt;session\_id&gt;,&lt;"topic"&gt;,&lt;length&gt;,&lt;qos\_level&gt;,&lt;retain&gt; |
| AT+MQTTPUBRAW=&lt;session\_id&gt;,&lt;"topic"&gt;,&lt;length&gt;,&lt;qos\_level&gt;,&lt;retain&gt; | In data mode,<ul class="ul" id="Toc184732458__ul_kb4_1mh_vdc"><br>                  <li class="li">The following is printed when all data is sent:<p class="p">+EVT:MQTT_PUBSUC:&lt;session_id&gt;,&lt;len&gt;,&lt;transport scheme&gt;,&lt;"host"&gt;,&lt;port&gt;</p><br></li><br><br>                  <li class="li">The following is printed if any data block fails to be sent:<p class="p">+EVT:MQTT_PUBFAIL:&lt;session_id&gt;,&lt;scheme&gt;,&lt;"host"&gt;,&lt;port&gt;</p><br></li><br><br>                </ul> |

### Defined values

- `<session_id>`: MQTT session ID
- `<"topic">`: The MQTT topic to publish to
- `<length>`: 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.
- `<qos_level>`: Quality-of-service level to use, range: 0–2, default: 0
- `<retain>`: Message should be retained, default 0.
- `<len>`: The total data length to send
- `<transport scheme>`: Transport scheme: TCP or SSL
Note: SSL isn't supported yet. The default value is TCP.
- `<"host">`: The name of the host to be connected, can be URL path or IP address
- `<port>`: The port number to connect

## AT+MQTTUNSUB

Source: [https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html)

This command unsubscribes from an MQTT topic.

### Operation type

Set/Execution

### Syntax

| Command | Response |
| --- | --- |
| AT+MQTTUNSUB | +MQTTUNSUB=&lt;session\_id&gt;,&lt;"topic"&gt;<br><br><br>                <br>OK |
| AT+MQTTUNSUB=&lt;session\_id&gt;,&lt;"topic"&gt; | +EVT:MQTT\_UNSUBSUC:&lt;session\_id&gt;,&lt;"topic"&gt;<br><br><br>                <br>+EVT:MQTT\_UNSUBFAIL:&lt;session\_id&gt;,&lt;"topic"&gt; |

### Defined values

- `<session_id>`: MQTT session ID
- `<"topic">`: The MQTT topic to unsubscribe from

## AT+MQTTDISCONN

Source: [https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html)

This command closes an MQTT connection.

### Operation type

Set/Execution

### Syntax

| Command | Response |
| --- | --- |
| AT+MQTTDISCONN | +MQTTDISCONN=&lt;session\_id&gt;<br><br><br>                <br>OK |
| AT+MQTTDISCONN=&lt;session\_id&gt; | +EVT:MQTT\_DISCONNECTED:&lt;session\_id&gt; |

### Defined values

`<session_id>`: MQTT session ID

## AT+MQTTDESTROY

Source: [https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html)

This command destroys an MQTT session.

### Operation type

Set/Execution

### Syntax

| Command | Response |
| --- | --- |
| AT+MQTTDESTROY | +MQTTDESTROY=&lt;session\_id&gt;<br><br><br>                <br>OK |
| AT+MQTTDESTROY=&lt;session\_id&gt; | +EVT:MQTT\_DESTROYED:&lt;session\_id&gt; |

### Defined values

`<session_id>`: MQTT session ID

## AT+MQTTMODE

Source: [https://docs.qualcomm.com/doc/80-Y8730-10/topic/mqtt_client_at_commands.html](https://docs.qualcomm.com/doc/80-Y8730-10/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=&lt;0|1: string|hex&gt;<br><br><br>                <br>OK |
| AT+MQTTMODE =&lt;0|1: string|hex&gt; | OK<br><br><br>                <br>Note: <br>                  <br>If the flag is set to 1, the format of `+EVT:MQTT_SUBRECV` will be changed to `+EVT:MQTT_SUBRECVHEX:<session_id>,<"topic">,<len>,<hex_data>` |

### Defined values

- `<session_id>`: MQTT session ID
- `<"topic">`: The MQTT topic to subscribe to
- `<len>`: Received payload length
- `<hex_data>`: Received hexadecimal payload

Last Published: Jun 03, 2026

[Previous Topic
TCPIP AT commands](https://docs.qualcomm.com/bundle/publicresource/80-Y8730-10/topics/tcpip_at_commands.md) [Next Topic
HTTP client AT commands](https://docs.qualcomm.com/bundle/publicresource/80-Y8730-10/topics/http_client_at_commands.md)