Skip to content

Experience RobustMQ MQTT

Prerequisite: Start the Broker

Follow the Quick Install guide to install RobustMQ, then start the service:

bash
robust-server start

Verify the broker is running:

bash
robust-ctl status

Choose an MQTT Client

Use either of the following to test MQTT publish and subscribe.

Option 1: MQTTX CLI

MQTTX CLI is an open-source MQTT command-line client by EMQ. See the installation guide at: https://mqttx.app/zh/docs/cli

Once installed, the mqttx command is available.

Option 2: robust-bench (built-in)

robust-bench is RobustMQ's built-in benchmarking tool — no extra installation needed. See the full usage guide: Bench CLI Documentation


Publish and Subscribe

Using MQTTX

Open two terminals and run:

bash
# Terminal 1: Subscribe
mqttx sub -h localhost -p 1883 -t "test/topic"

# Terminal 2: Publish
mqttx pub -h localhost -p 1883 -t "test/topic" -m "Hello RobustMQ!"

If the subscriber receives the message, MQTT is working correctly.

Common options:

bash
# Specify QoS
mqttx pub -h localhost -p 1883 -t "test/qos1" -m "msg" -q 1

# Publish a retained message
mqttx pub -h localhost -p 1883 -t "test/retained" -m "retained msg" -r

# Wildcard subscription
mqttx sub -h localhost -p 1883 -t "test/#"

Using robust-bench

bash
# Connection benchmark (establish 100 connections)
robust-bench mqtt conn --count 100

# Publish benchmark (100 clients, 30 seconds)
robust-bench mqtt pub --count 100 --duration-secs 30

# Subscribe benchmark (100 clients)
robust-bench mqtt sub --count 100 --duration-secs 30

For more options see the Bench CLI Documentation.


SDK Integration

RobustMQ is fully compatible with MQTT 3.x / 5.0. Any standard community MQTT SDK works out of the box — no custom adapters needed.

Connection Details

ParameterValue
Hostlocalhost (local) or public server 117.72.92.117
Port1883 (TCP) / 8083 (WebSocket)
Usernameadmin
Passwordrobustmq

SDKs by Language

LanguageSDKInstall
Goeclipse/paho.mqtt.golanggo get github.com/eclipse/paho.mqtt.golang
Javaeclipse/paho.mqtt.javaMaven / Gradle
Pythoneclipse/paho-mqtt-pythonpip install paho-mqtt
JavaScriptMQTT.jsnpm install mqtt
Ceclipse/paho.mqtt.cBuild from source

Quick Example

The following Go snippet shows the minimal connect / publish / subscribe flow:

go
import mqtt "github.com/eclipse/paho.mqtt.golang"

opts := mqtt.NewClientOptions().
    AddBroker("tcp://localhost:1883").
    SetClientID("my-client").
    SetUsername("admin").
    SetPassword("robustmq")

client := mqtt.NewClient(opts)
client.Connect().Wait()

// Publish
client.Publish("test/topic", 0, false, "Hello RobustMQ!")

// Subscribe
client.Subscribe("test/topic", 0, func(_ mqtt.Client, msg mqtt.Message) {
    fmt.Println(string(msg.Payload()))
})

Full Documentation

For complete examples covering QoS, SSL/TLS, will messages, and more:

🎉 既然都登录了 GitHub,不如顺手给我们点个 Star 吧!⭐ 你的支持是我们最大的动力 🚀