MQTT Broker
Device Agent uses an MQTT Broker to connect real devices, SDKs, and the browser simulator. Before starting Device Agent, prepare these MQTT settings:
MQTT_BROKER_URL=
VITE_MQTT_WS_URL=
MQTT_USERNAME=
MQTT_PASSWORD=Use mqtts:// for MQTT over TLS and wss:// for WebSocket over TLS. If the browser console and Device Agent run on different machines, do not use localhost; use a host or IP reachable from the browser.
Zero EMQX
Use Zero EMQX when you only need to get device connections working quickly. It creates a temporary MQTT Broker with MQTTS/WSS endpoints and credentials. Zero EMQX is powered by EMQX Cloud, expires automatically, and is not intended for long-term use.
There are three ways to create Zero EMQX.
Fastest Path: Auto-create at Startup
For first deployment or first startup, set ZERO_EMQX_ENABLED=true:
ZERO_EMQX_ENABLED=trueAt startup, Zero EMQX is created automatically and the MQTT settings are saved to the configuration. A workspace that has already created Zero EMQX will not create another one. To keep this variable in .env, create the file at the path described in Environment Variables.
Optional: set these only when a custom manager endpoint or tag is required:
ZERO_EMQX_MANAGER_URL=https://zero.emqx.io
ZERO_EMQX_TAG=device-agentCreate from Settings
When Device Agent is already running, open Settings → MQTT and click Create test broker. After creation, save the MQTT settings page so the running gateway uses the new configuration.
Ask the Agent
In Device Agent, say:
Create a Zero EMQX MQTT Broker test instance and write the MQTT settings into this workspace.After the Agent creates Zero EMQX, save the MQTT settings page so the running gateway uses the new configuration.
EMQX
Use EMQX when you want to run an MQTT Broker on your own infrastructure. It is suitable for production, private networks, local data residency, and self-managed clusters.
Docker:
docker run -d --name emqx \
-p 1883:1883 -p 8083:8083 -p 8084:8084 -p 8883:8883 -p 18083:18083 \
emqx/emqx-enterprise:latestQuick install script:
curl -fsSL emqx.sh | bash
emqx startThe default EMQX Dashboard is http://localhost:18083/.
Without client authentication, start with:
MQTT_BROKER_URL=mqtt://127.0.0.1:1883
VITE_MQTT_WS_URL=ws://127.0.0.1:8083/mqtt
MQTT_USERNAME=
MQTT_PASSWORD=If authentication or TLS is enabled, copy the username, password, and listener endpoints from the EMQX Dashboard.
EMQX Cloud
Use EMQX Cloud when you want a fully managed MQTT Broker with less deployment, upgrade, and operations work. It is suitable for long-term use, team sharing, and more device connections.
- Sign in or sign up for EMQX Cloud.
- Create a Serverless, Dedicated Flex, or BYOC deployment.
- Copy the MQTT and WebSocket endpoints from the deployment Overview page.
- Create client credentials under Access Control > Client Authentication.
Serverless uses TLS by default:
MQTT_BROKER_URL=mqtts://<deployment-host>:8883
VITE_MQTT_WS_URL=wss://<deployment-host>:8084/mqtt
MQTT_USERNAME=<client-username>
MQTT_PASSWORD=<client-password>
MQTT_TLS_ENABLED=true
MQTT_TLS_REJECT_UNAUTHORIZED=trueEMQX Edge
Use EMQX Edge when Device Agent runs on an on-site gateway, industrial computer, or small edge device and should stay close to the device network.
Linux:
curl -fsSL emqx.sh/edge | bash
source /etc/profile.d/emqx-edge.sh && emqx-edge startThe default EMQX Edge Dashboard is http://localhost:8081/. For Docker deployment, follow the official docs.
LAN example:
MQTT_BROKER_URL=mqtt://edge-gateway.local:1883
VITE_MQTT_WS_URL=ws://edge-gateway.local:8083/mqtt
MQTT_USERNAME=
MQTT_PASSWORD=Choose
| Need | Use |
|---|---|
| Quick demo | Zero EMQX |
| Private deployment, self-managed operations, local data residency | EMQX |
| Fully managed broker, less operations work, team sharing | EMQX Cloud |
| On-site gateway, small edge device, device-side network | EMQX Edge |