This article will use MQTTBox 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 MQTTBox and the basic concepts and usage of the MQTT protocol.

Introduction to MQTTBox

MQTTBox is an MQTT client tool personally developed by Sathya Vikram. Initially, it was only used as an extension installation on Chrome, and it was rewritten and open sourced to become a desktop cross-platform software. The interface is simple and straightforward, and supports multiple clients online at the same time, but there are still some inconveniences in the interaction between clients, such as switching and sending messages. MQTTBox uses Chrome to achieve powerful cross-platform features, combined with simple load testing functions, is an MQTT client tool worth trying.

MQTTBox fully supports the following functions:

  • Easy to install by supporting Chrome OS, Linux, macOS, Windows Chrome storage, support Linux, macOS, Windows independent installation
  • Support MQTT, MQTT over WebSocket, multiple TCP encrypted connections
  • Save history of sent messages
  • Copy/paste messages in history
  • Save subscription message history
  • Simple performance test, test Broker's load and visualize the test results through graphs

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 view EMQ X Cloud document .

MQTTBox use

MQTT connection

Initialize the page

After opening the software, enter the main interface of the software, click the Create MQTT Clinet button on the top menu bar, and enter the page for creating MQTT client.

MQTTBox 界面

Create connection

After entering the page for creating MQTT client, fill in the MQTT-related configuration information such as Host and select the connection protocol, and click the Save button at the bottom to immediately create a connection client.

Note: When you fill in the Host, you need to fill in the complete address, including the port number of the connection. If it is a WebSocket connection, Path must also be added. If MQTT Broker enables user name/password authentication, you also need to enter Username/Password in the configuration page

MQTTBox 创建连接

After the save is successful, you will enter a client details page. If the button in the upper right corner displays Connected and is green, it means that the MQTT client has successfully connected. Click it again to disconnect the client.

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 connecting, and then there will be messages on the topic to receive pushes from EMQ X Cloud.

There are two input boxes for sending and subscribing by default in the client details page of MQTTBox. If there are multiple subscriptions or different publication content, you can add multiple Add publisher . Click the 061136e6e6fe2b and Add subscriber buttons in the top menu bar to add and manage multiple publications and subscriptions.

We first enter the topic in the yellow box on the right: testtopic/mqttbox , after selecting the QoS level, click the Subscribe button to subscribe to the related topic.

MQTT news release

Then we enter the Topic to be published in the blue box, here we enter the testtopic/mqttbox we just subscribed to, select the QoS level, select the default Payload Type, which supports String / JSON / XML / Characters , and after we enter a piece of JSON in the Payload box, click the Publish button.

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

MQTTBox 消息发布

TLS/SSL connection

In addition to ordinary connections, MQTTBox also supports TLS/SSL connections.

If you use EMQ X Cloud, you can refer to the document to create a certificate. We can enter the client details page, select the protocol as mqtts/tls or wss, and then select save.

If it is two-way authentication, you can select the CA certificate file, client certificate and client key file in the configuration page, and then select the connection. Please confirm the TLS/SSL connection port and modify it before connecting.

MQTTBox TLS/SSL 连接

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

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


EMQX
336 声望437 粉丝

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