Skip to main content

MQTT

MQTT is a lightweight publish/subscribe messaging protocol designed for IoT and M2M communication.

Overview

Connecting to a Broker

  1. Select MQTT from the protocol dropdown
  2. Configure the connection:
    • Broker: localhost or mqtt.example.com
    • Port: 1883 (default) or 8883 (TLS)
    • Client ID: Auto-generated or custom
  3. Click Connect

Connection Settings

FieldDescriptionDefault
BrokerHostname or IP-
PortBroker port1883
Client IDUnique identifierAuto-generated
UsernameAuth username(optional)
PasswordAuth password(optional)
Use TLSEnable encryptionfalse

Subscribing to Topics

Once connected:

  1. Enter a topic pattern in the Topic field
  2. Click Subscribe

Topic Patterns

PatternMatches
sensors/temperatureExact topic
sensors/+Single-level wildcard
sensors/#Multi-level wildcard

Examples:

  • home/+/temperature matches home/living/temperature, home/bedroom/temperature
  • home/# matches all topics under home/

Publishing Messages

  1. Enter the target Topic
  2. Type your message
  3. Select QoS level
  4. Toggle Retain if needed
  5. Click Publish

QoS Levels

LevelNameGuarantee
0At most onceFire and forget
1At least onceAcknowledged delivery
2Exactly onceFour-part handshake

Retained Messages

When Retain is enabled, the broker stores the last message for the topic. New subscribers immediately receive this message.

Message Log

The message log shows:

ColumnDescription
Direction↑ Published / ↓ Received
TopicMessage topic
QoSQuality of Service level
PayloadMessage content
TimestampWhen sent/received

Playground Example

The playground includes an MQTT broker:

Broker: localhost
Port: 19511

Publish Temperature

Topic: sensors/temperature
Message: {"value": 22.5, "unit": "celsius"}
QoS: 1
Retain: false

Subscribe to Sensors

Topic: sensors/#

This will receive all messages published to any sensors/ subtopic.

Example: IoT Sensor

Publisher (Sensor)

Topic: home/living-room/temperature
QoS: 1
Message:
{
"device": "sensor-001",
"temperature": 23.5,
"humidity": 45,
"timestamp": "2024-01-15T10:30:00Z"
}

Subscriber (Dashboard)

Topic: home/+/temperature

Receives temperature from all rooms.

Authentication

For secured brokers:

  1. Enter Username and Password
  2. Enable Use TLS for encrypted connections
  3. Connect

Troubleshooting

Connection Failed

  • Verify broker hostname and port
  • Check if the broker is running
  • Ensure firewall allows the connection

No Messages Received

  • Verify topic subscription matches published topic
  • Check if wildcard patterns are correct
  • Ensure QoS levels are compatible

Authentication Error

  • Verify username and password
  • Check if the user has subscribe/publish permissions