Documentation

Quick start

Everything you need to connect your first device to MQTT One: connection details, code examples and best practices.

Before you start

To connect to MQTT One you need a broker address, a username and a password. These are created for you automatically when you start a project on the iotBind platform.

  1. Create a free account or log in on iotBind.
  2. Create a new project (or open an existing one).
  3. Open the project details to find your broker address, credentials and the topics assigned to it.

Connection details

Use the values below with any MQTT client. In the examples on this page, your-broker.mqtt.one is a placeholder: replace it with the broker address shown in your project.

SettingValue
Broker addressyour-broker.mqtt.one (from your project)
MQTT (TCP)1883
MQTT over TLS8883
WebSocket8083, path /mqtt
Secure WebSocket8084, path /mqtt
Username / passwordYour broker credentials from the project
Client IDAny unique value per device, e.g. esp32-kitchen-01
Protocol versionMQTT 3.1 / 3.1.1

Several brokers are available, and each project uses its own broker address. Always copy the exact address from your project.

Code examples

Pick your platform. Replace YOUR_USERNAME, YOUR_PASSWORD, the broker address and your/topic with the values from your project.

terminal
# Subscribe to a topic (keeps listening)
mosquitto_sub -h your-broker.mqtt.one -p 1883 \
  -u "YOUR_USERNAME" -P "YOUR_PASSWORD" \
  -t "your/topic" -q 1 -v

# Publish a message from another terminal
mosquitto_pub -h your-broker.mqtt.one -p 1883 \
  -u "YOUR_USERNAME" -P "YOUR_PASSWORD" \
  -t "your/topic" -m "hello from MQTT One" -q 1

# Encrypted connection over TLS
mosquitto_sub -h your-broker.mqtt.one -p 8883 --capath /etc/ssl/certs \
  -u "YOUR_USERNAME" -P "YOUR_PASSWORD" -t "your/topic"

Topics and access rules

Each broker user can only publish or subscribe to the topics it has been granted. Your project lists the topics you can use and whether each one allows publishing, subscribing or both.

  • Use the exact topic names shown in your project — topic names are case-sensitive.
  • Use levels separated by / to organize data, for example your/topic/temperature.
  • Use letters, numbers, dashes and underscores; avoid spaces and special characters.
  • Wildcards + and # can be used when subscribing, within the topics you are allowed to access.

Best practices

Unique client IDs

Two clients with the same client ID disconnect each other. Give every device its own ID.

Keep alive

Use a keep-alive interval of 30–60 seconds so broken connections are detected quickly.

Reconnect automatically

Networks drop. Make your device retry the connection with a short delay instead of stopping.

Choose the right QoS

QoS 0 for frequent telemetry, QoS 1 for most messages, QoS 2 only when duplicates are unacceptable.

Retain and Last Will

Retain the latest state, and register a Last Will message to announce when a device goes offline.

Encrypt on public networks

Use port 8883 (TLS) or 8084 (secure WebSocket) whenever data crosses the internet.

Troubleshooting

ProblemWhat to check
Connection refused: not authorizedCheck the username and password, and make sure you copied the broker address of the same project.
Connected, but no messages arriveMake sure the publisher and subscriber use exactly the same topic and that your user is allowed to subscribe to it.
Disconnects every few secondsAnother client is probably using the same client ID. Use a unique ID per device.
Cannot connect from the browserBrowsers need WebSocket: use port 8084 with wss:// and the path /mqtt.
Connection times outYour network may block the port. Try another port such as 8883 or 8084, or test from a different network.

Connect your first device in minutes

Create a free iotBind account, start a project and get your own MQTT One broker credentials instantly.