Practical MQTT guide
MQTT broker guide
Understand MQTT brokers and test them with a desktop client.
The broker is the message hub.
An MQTT broker accepts client connections, receives published messages, matches topic filters, and forwards messages to subscribed clients.
Common ports are 1883 for MQTT over plain TCP and 8883 for MQTT over TLS. Some platforms also expose MQTT over WebSocket for browser-based clients.
How to test a broker.
Use a desktop client such as MQTT.fx, MQTTX, or MQTT Explorer. Connect with the broker host and port, subscribe to a topic, publish a payload, and verify delivery.
For production systems, test authentication, TLS certificates, retained messages, QoS behavior, offline sessions, and topic permission rules separately.
Choose ports and security deliberately.
Use port 1883 only for an isolated plain-TCP test where transport encryption is not required. Use 8883 for MQTT over TLS. WebSocket deployments commonly use 80 or 443, but the path and protocol settings are broker-specific.
A repeatable smoke test uses two clients: client A subscribes to `iot01/test/#` at QoS 1, then client B publishes `{"status":"ok"}` to `iot01/test/device-1`. Verify delivery, then test invalid credentials and a denied topic to confirm policy behavior.
Free public endpoints are for short-lived tests.
A public broker can confirm basic client connectivity, but shared infrastructure is not appropriate for secrets, production payloads, private topic names, or reliability conclusions.
For team or device testing, prefer an isolated broker with explicit credentials, TLS, topic permissions, observability, and a documented retention policy.
Common questions
What is an MQTT broker?
An MQTT broker is the server that receives messages from publishing clients and forwards messages to clients subscribed to matching topics.
What is MQTT broker port 1883?
Port 1883 is the common default port for MQTT over plain TCP. TLS-secured MQTT commonly uses port 8883.
Does an MQTT broker store messages?
It can store retained messages and session state depending on configuration. Long-term message storage depends on the broker product and persistence settings.