MQTT Protocol Testing Tool

Online MQTT client, supports connection testing, message publishing & subscribing, protocol debugging/analysis. Suitable for IoT device testing and MQTT protocol learning.

Disconnected
Supports ws:// or wss:// protocol

MQTT Communication Log

[Time] MQTT testing tool ready. Please enter connection parameters to start.

MQTT Protocol Introduction

MQTT (Message Queuing Telemetry Transport) is a lightweight publish/subscribe messaging protocol designed for low-bandwidth, high-latency, or unreliable networks. It is widely used in the Internet of Things (IoT) field and is a key protocol for device-to-cloud communication.

MQTT Protocol Features

MQTT Protocol Core Concepts

Concept Description
Broker MQTT server, responsible for receiving, filtering, and forwarding messages.
Client MQTT client, can be a publisher, subscriber, or both.
Topic Message topic for categorizing and routing messages, supports wildcards.
Publish Publish a message to a specified topic.
Subscribe Subscribe to one or more topics to receive relevant messages.
QoS Quality of Service level (0-2), determines message delivery reliability.

MQTT Quality of Service (QoS) Levels

MQTT provides three Quality of Service levels to ensure message delivery reliability for different scenarios:

QoS Level Name Description Applicable Scenario
0 At most once Message sent without confirmation, may be lost. Non-critical data, e.g., periodic sensor reports.
1 At least once Ensures message is delivered at least once, may be duplicated. Important data that cannot be lost.
2 Exactly once Ensures message is delivered exactly once, no duplication. Critical business data, e.g., payment commands.

MQTT Testing Tool User Guide

Connect to MQTT Broker

  1. Enter Broker URL (supports WebSocket protocol)
  2. Set Client ID (recommend using a unique identifier)
  3. Fill in Username and Password if authentication is required
  4. Click the "Connect" button to establish connection

Subscribe to Topic

  1. Enter topic name in the "Subscribe Topic" input
  2. Click the "Subscribe" button to subscribe
  3. After successful subscription, all messages for that topic will be received

Publish Message

  1. Enter target topic in the "Publish Topic" input
  2. Enter the message to send in the "Message" text box
  3. Click the "Publish Message" button to send

Testing Tips:You can use public MQTT Brokers for testing, such as broker.emqx.io, test.mosquitto.org, etc. These public servers are available without registration and are suitable for learning and testing.

MQTT Topic Design Best Practices

Topic Hierarchy Structure

A well-designed topic structure improves system maintainability and scalability:

Topic Wildcards

MQTT supports two wildcards for subscribing to multiple related topics:

Frequently Asked Questions

Why does the connection fail?

Possible reasons for connection failure:

How to choose the appropriate QoS level?

Choose based on business requirements:

Difference between MQTT over WebSocket and TCP?

MQTT over WebSocket enables MQTT protocol usage in browser environments, while standard MQTT is based on TCP. The WebSocket version is more suitable for web applications and frontend-backend communication.

MQTT Application Scenarios