1

This article will use MQTTLens as the MQTT client test tool to access the MQTT cloud service-EMQ X Cloud . Through this article, you will be able to quickly understand the basic usage of MQTTLens and the basic concepts and usage of the MQTT protocol.

Introduction to MQTTLens

MQTTLens is a Chrome extension tool that can be installed through the Chrome web store. The MQTTLens interface is very simple and provides basic publish and subscribe functions.

MQTTLens is simple enough. With the help of Chrome's powerful cross-platform features, it provides the basic MQTT and MQTT over WebSocket connection functions, which can quickly meet the entry and exploration use.

MQTTLens fully supports the following functions:

  • Can establish connections with multiple MQTT servers at the same time, and use different colors to distinguish
  • The interface for subscribing, publishing and checking news is very simple and easy to master
  • Support MQTT and MQTT over WebSocket

Introduction to EMQ X Cloud

EMQ X Cloud is EMQ that can connect to massive IoT devices and integrate various databases and business systems. As the world's first all-hosted MQTT 5.0 public cloud services , EMQ the X-Cloud hosting provides a one-stop operation and maintenance, the unique environment of isolation MQTT messaging service.

In the era of the Internet of Everything, EMQ X Cloud can help users quickly build industry applications for the Internet of Things, and easily realize the collection, transmission, calculation and persistence of Internet of Things data.

This article will use the 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-cn.emqx.io
  • TCP Port: 1883
  • SSL/TLS Port: 8883

For more details, please visit EMQ X Cloud official website , or check EMQ X Cloud document .

MQTTLens use

MQTT connection

Initialize the page

We enter the Chrome web app store, click install and then open the app in Chrome.

After entering the main interface of the application, we click on the Connections button on the right to create a new connection client.

MQTTLens 界面

Create connection

After clicking the Create button, a pop-up box for filling in MQTT related configuration will appear. Fill in Connection name , Hostname , Port , select the connection protocol and other necessary MQTT related configuration information, and click the CREATE CONNECTION button at the bottom to immediately create a connection client.

MQTTLens also supports the configuration of the will message. At the bottom of the creation pop-up box, click Last-Will to configure the relevant configuration.

Note: If MQTT Broker has enabled username/password authentication, you also need to enter Username/Password in the configuration page

创建连接

After the creation is successful, the application will enter the operation page for connecting to the client. If the button in the connection list on the right turns green, it means that the MQTT client has been successfully created and successfully connected. Click the green button again to turn it into red, you can disconnect. Click the settings button on the right to edit the client configuration again, and click the delete button to quickly delete the connection.

Subscribe to topics

After completing the connection establishment, you can start subscribing to messages. Because the MQTT protocol uses a publish/subscribe model, we need to subscribe to the topic after connection, and the message of the topic can be received after the subscription is successful.

In the operation page of the MQTTLens client, there are three modules in the right view, namely Subscrible , Publish and Subscriptions . Subscrible configures the subscription topic, Publish can be configured to send related data and configuration information, when a message is received, a message list Subscriptions

We first enter Topic Subscrible at the top testtopic/mqttlens , after selecting the QoS level, click the Subscribe button to subscribe to the related Topic.

MQTT news release

Enter the Topic to be published in the Publish testtopic/mqttlens subscribed just now, select the QoS level, if it is a retained message, you need to check the retained option. After entering a piece of character information in the Payload box, click the Publish button.

MQTTLens 发布消息

At this point, we can see the message just released in Subscriptions So far, we have created an MQTT client and successfully tested functions such as connection, publishing, and subscription.

Copyright notice: This article is the EMQ , please indicate the source for reprinting.

Original link: https://www.emqx.com/zh/blog/connecting-to-emqx-cloud-with-mqttlens


EMQX
336 声望437 粉丝

EMQ(杭州映云科技有限公司)是一家开源物联网数据基础设施软件供应商,交付全球领先的开源 MQTT 消息服务器和流处理数据库,提供基于云原生+边缘计算技术的一站式解决方案,实现企业云边端实时数据连接、移动、...