sondahub / Public MQTT broker
Public MQTT broker over WebSocket
MQTT 3.1.1 and 5 over wss://, free and open, with a simulated IoT fleet already talking: telemetry every two seconds, alerts, retained device status, and devices that answer the commands you publish.
WebSocket only — there is no TCP port 1883 — and every connection gets its own broker. Both explained below.
Connect
- URL
- wss://api.sondahub.com/mqtt
- Host / port / path
- api.sondahub.com · 443 · /mqtt
- Transport
- WebSocket over TLS, subprotocol mqtt
- MQTT
- 3.1.1 and 5
- Credentials
- any, or none
MQTT.js (browser or Node)
import mqtt from 'mqtt'
const client = mqtt.connect('wss://api.sondahub.com/mqtt', { protocolVersion: 5 })
client.on('connect', () => {
client.subscribe(['fleet/+/telemetry', 'fleet/alerts'])
client.publish('fleet/WM5-NY5C7A/commands', JSON.stringify({ action: 'reboot' }))
})
client.on('message', (topic, payload) => console.log(topic, payload.toString()))
Python (paho-mqtt 2)
import paho.mqtt.client as mqtt
def on_connect(client, userdata, flags, reason_code, properties):
client.subscribe("fleet/+/telemetry")
client = mqtt.Client(mqtt.CallbackAPIVersion.VERSION2, transport="websockets")
client.ws_set_options(path="/mqtt")
client.tls_set()
client.on_connect = on_connect
client.on_message = lambda c, u, msg: print(msg.topic, msg.payload.decode())
client.connect("api.sondahub.com", 443)
client.loop_forever()
What is on it
The Fleet API: 500 devices across 40 sites. Serial numbers come from the devices (WM5-NY5C7A is the first one online); a command to any serial is acknowledged.
The broker publishes
| Topic | What |
|---|---|
fleet/{serial}/telemetry | Readings, JSON, every 2 s from a rotating set of devices. Subscribe to fleet/+/telemetry for all of them. |
fleet/{serial}/status | Retained. online | offline | degraded, changing now and then. |
fleet/{serial}/ack | The answer to a command you published. |
fleet/alerts | Alerts as they open and resolve. |
$SYS/broker/clients/connected, $SYS/broker/uptime | Broker stats every couple of seconds. |
You publish
| Topic | What |
|---|---|
fleet/{serial}/commands | Publish {"action":"reboot"} (or set_config, report_now, identify) and the device acknowledges on fleet/{serial}/ack. |
anything else | A plain broker: whatever you publish reaches your own matching subscriptions, retained flag honoured. |
Questions
Is there a free public MQTT broker for testing?
Yes: wss://api.sondahub.com/mqtt — MQTT 3.1.1 and 5 over secure WebSocket, any client id, username and password, no signup. It comes with something to listen to: telemetry from simulated devices every two seconds.
Can I connect on port 1883 or 8883?
No. The broker runs where only HTTP reaches, so it speaks MQTT over WebSocket only: port 443, path /mqtt, subprotocol mqtt. Most MQTT clients and libraries offer a WebSocket transport.
Can two of my clients message each other through it?
No — and that is the one way it differs from a shared broker. sondahub keeps no shared state, so each connection gets its own broker: what you publish reaches your own subscriptions (retained flag honoured), and the simulated devices answer you, but another client will not see it.
Which QoS levels work?
QoS 0 and 1 fully; QoS 2 is handshaken and delivered at 1. Retained messages (up to 500 per connection), + and # wildcards, MQTT 5 topic aliases and $SYS topics behave.