Using MQTT Explorer to connect to EMQ X Cloud
This article will take MQTT Explorer as MQTT client test tool to connect to MQTT Cloud Service - EMQ X Cloud. Through this article, you will be able to quickly understand the basic usage of MQTT Explorer and the basic concepts and usage of the MQTT protocol.
Introduction to MQTT Explorer
MQTT Explorer is currently a relatively active MQTT client desktop application, which has always been liked by developers. Its main technology is Electron, which is developed by @thomasnordquist and open-sourced, and follows Creative Commons Public Licenses protocol. GitHub address is https://github.com/thomasnordquist/MQTT-Explorer.
Its main features are:
- Basic subscription/push/connection function
- User authentication function
- WebSocket support
- Support diff view and multiple types of Payload
- Basic historical information log
- Support TLS connection
- Support night mode
In particular, some good features are:
- Automatically subscribe to the topic of $SYS for easy check of broker status information
- Organize the subscription list in a tree structure to facilitate users to view their attribution
- With message visualization function and intuitive and interactive statistical chart design
MQTT Explorer can meet most development needs, but it also has some disadvantages:
- Only one connection can exist at a time, which is not convenient for multiple-connections debugging
- Publish payload and Subscribe Message list are not separated in UI design so that it is not easy to check the status of sending and receiving messages
- There is no complete operation log record, which makes it inconvenient for developers to check the information interacting with the server
Introduction to EMQ X Cloud
EMQ X Cloud is a fully managed cloud-native MQTT service launched by EMQ company that can connect to a large number of IoT devices and integrate various databases and business systems. As the world's first fully managed MQTT 5.0 public cloud service, EMQ X Cloud provides MQTT message service with one-stop operation and maintenance management and a unique isolation environment.
In the era of the Internet of Everything, EMQ X Cloud can help users quickly build industry applications for the IoT area and easily realize the collection, transmission, calculation, and persistence of IoT data.
This article will use Free Public MQTT Server provided by EMQ X Cloud as the MQTT server address for this test. The server access information is as follows:
- Broker: broker.emqx.io
- TCP Port: 1883
- SSL/TLS Port: 8883
MQTT Explorer usage
The main page is shown in the figure below, with the topic search bar and connection configuration at the top. On the lower left of the page, it is the tree structure of the topic, and on the right, it is the Publish column, Subscribe column, Payload column, and History information control column.
The configuration page will pop up when you enter MQTT Explorer for the first time.
Create a connection
Click Connections to create a new connection, and fill in the Host as broker-cn.emqx.io, the port as 1883, and the protocol as MQTT protocol.
Subscribe to a topic
Then, click Advanced. Because EMQ X Cloud prohibits the
$SYS topic and the
# topic by default, we delete them and enter a test subscription topic with the name
test/1, and the result is shown in the figure below.
Finally, click Back to return to the connection configuration page, and click Connect to complete the connection of EMQ X Cloud and the subscription of the topic
After the connection is successful, you can see that the subscription tree structure has
1 nodes, and the status bar at the top right shows that it has been connected, and the title of the topic
test/1 is contained on the right.
MQTT message publishing
After the connection is established, enter
/test/1 in the topic box at the bottom right corner of the page, and enter some text, and then click Publish to send the message.
Receive subscription messages
After the publish is successful, the message just published will be received in the Value card at the top right.
In the History card at the bottom right corner of the page, you can see the message records received by the relevant subscription topic.
Statistical information will be displayed at the bottom right corner of the page.