> For the complete documentation index, see [llms.txt](https://docs.eseye.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eseye.com/smartconnect/at-command-reference/mqtt-at-commands.md).

# MQTT AT commands

AnyNet SMARTconnect™ Message Queuing Telemetry Transport (MQTT) AT commands are specific to devices that have built-in MQTT capabilities. They provide a simple and lightweight way to implement MQTT communication on a wide range of IoT devices.

{% hint style="info" %}
Send the following AT command to enable AnyNet SMARTconnect™ MQTT on your device: `AT+ETMSTATE="startmqtt"` If the configuration file \[operation] \<mode> parameter is set to `mqtt`, then AnyNet SMARTconnect™ automatically starts MQTT after power up. If the \<mode> is not set, after each reboot you must send `AT+ETMSTATE="startmqtt"` again.
{% endhint %}

The MQTT client registers each topic with an index that is used to publish the messages. The response indicates acceptance or rejection of the topic. Optionally, you can configure a single fixed topic so the module need not keep track of topic indices for sending or receiving data.

The MQTT client supports QoS 0 and 1, and always connects to the broker as a clean session. All publish messages are queued in a non-volatile flash memory until they are sent to the broker. For QoS 1 messages, AnyNet SMARTconnect™ waits for a puback from the broker before discarding the sent data and transmitting the next message. This mechanism queues messages while a network connection is not available, and forwards messages when the connection establishes.

In the event of a power failure, queued messages are retained until reconnection occurs. Retained message storage is defined by `nvqueuemaxsize` in the Configuration File. For more information, see [Using the AnyNet SMARTconnect™ configuration file](https://docs.eseye.com/smartconnect/getting-started/using-the-anynet-smartconnect-tm-configuration-file.md).

Retained messages are expunged from the flash memory when the broker successfully receives them.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.eseye.com/smartconnect/at-command-reference/mqtt-at-commands.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
