What is MQTT?

MQTT (Message Queuing Telemetry Transport) is a "lightweight" communication protocol based on the publish/subscribe model. Built on the TCP/IP protocol, it is a low-overhead, low-bandwidth instant messaging protocol, making it widely applicable in areas such as the Internet of Things, small devices, and mobile applications.

UIFlow and MQTT

In UIFlow, we can utilize the MQTT feature to enable communication and interaction between two or more COREs, thereby achieving robust remote control capabilities.

UIFlow and MQTT

MQTT Server

Choosing an MQTT Service

To engage in data exchange using the MQTT protocol, server support is needed. There are many third-party server platforms to choose from; here, we demonstrate the platform CloudMQTT.

Once you have set up a service on the platform, you will receive some configuration information, such as the server address, username, password, etc., which will be used in the MQTT blocks in UIFlow.

MQTT Server Information

MQTT Features

In the advanced features of UIFlow, you can find MQTT functionality blocks. We can simply understand the MQTT protocol as consisting of two parts: "publishing" and "subscribing."

Once a publisher posts a message, subscribers will receive this information, thus facilitating communication between devices.

MQTT Features in UIFlow

Initializing the Program

MQTT Configuration Block

Add an MQTT configuration block and connect it to the Setup block.

MQTT Configuration Block

Filling in Information

Enter the server information from your personal or third-party server platform to prepare for the connection.


When you have multiple devices in use at the same time, the ID name (the ID in the picture is "M5stack") must not duplicate any other options in the configuration information, nor can it duplicate the ID of any other devices. At the same time, within the same server, only one device with the same ID name is allowed online. If you need to download the program to a device for running, you must add a Wi-Fi connection program at the start of the program.

MQTT ID and Starting the Connection

MQTT Start

Add a Start block below the MQTT configuration block, indicating that the system will begin running once the configuration is set.

MQTT Start Block


Function Description

Publishing refers to the act of sending data in communication, including two parts: the "topic" and the "message."

Publishing in MQTT

Publish "Topic"

Set a publishing topic. Other devices will need to subscribe to the matching topic name to receive the content information under that topic.

Publish "Message"

Set the content information to be published.


When the program runs to the Publish block, it performs message publishing. For example:

  • When the A button is pressed, publish a message (topic "RGB", message "open").
  • When the B button is pressed, publish a message (topic "RGB", message "close").

Using Publish in UIFlow


Function Description

Subscribing refers to the act of receiving data in communication. Once a publisher has posted information, subscribers will automatically receive the topic and message content they have subscribed to.

Subscribe "Topic"

Set the topic you want to subscribe to.

Subscribing to a Topic

Get Topic Data "Message"

Receive the message content under that subscription.

Getting Topic Data


Add a Subscribe block and fill in the topic you want to subscribe to. Use the Get topic data block to receive and process the data. For example:

  • If "open" is received from the Publish, light up the RGB bar.
  • If "close" is received, turn off the RGB bar.
On This Page