directory

Introduction to the EMQ cloud server

Setting up the EMQ cloud server

Message subscription & publish tests

1. Set the connection to the server

2. Message subscription

3. News release


Hello! Hello, everyone! I’m a grey ape trying to make money to buy hair tonic!

Recently, I used EMQ server to transmit MQTT protocol information when I was developing the Internet of things. Today, I would like to record the building of EMQ server in Windows environment and a simple use tutorial with you.

 

Introduction to the EMQ cloud server

EMQ X is a fully hosted MQTT cloud server that enables rapid deployment, easy management, and on-demand scaling of IOT MQTT 5.0. Currently supported MQTT protocol versions include MQTT V3.1, V3.1.1 and V5.0 and MQTT over WebSocket.

Official documentation for EMQ X

 

Setting up the EMQ cloud server

The steps for setting up an EMQX cloud server are as follows:

1. The EMQ cloud server needs to be downloaded from the official website, click to enter the download address;

2. Then find the corresponding version of the EMQ server (I have installed the latest version of V4.1.2).

3. Decompress the downloaded EMQ cloud server package.

4. Open the CMD command line interface (CLI) and go to the decompressed directory of the EMQ cloud server

5. Enter bin\emqx start or bin\emqx console and press Enter to start the EMQ cloud server. If no error or other information is displayed during the startup, the EMQ cloud server is successfully started

6. Open the console http://127.0.0.1:18083 of the EMQ cloud server in the browser. The default user name and password for the first login are admin and public.

You can modify the panel style and language in the Console Settings

Another point to note here is that before opening the website each time, you need to enter the command “bin\emqx start” or “bin\emqx console” in the CMD command line in step 5 and press Enter to start the EMQ cloud server to successfully enter the server interface.

 

Message subscription & publish tests

EMQX cloud server has its own client debugging function panel. Simple message publishing and subscription tests can be carried out in tools – > WebSocket.

As we know, MQTT protocol is a lightweight transport protocol based on publish/subscribe mode, so the server and the topic of subscription need to be configured accordingly when subscribes and publishes messages.

1. Set the connection to the server

Configure the connected server in WebSocket, including host address, port, client ID, and user name and password for encryption, etc. Click connect to start after setting.

 

2. Message subscription

The subscription of MQTT protocol messages is required to include the topic of the message and the quality of service. The topic of the message is “a label that sends the message”, and the quality of service includes 0, 1, and 2, as shown in the following table:

Qos values Bit2 Bit1 describe
0 0 0 Distribute at most once
1 0 1 At least once
2 1 0 Only once

Once set up, you can subscribe to messages for that topic

 

3. News release

The publication of MQTT protocol messages also needs to include the topic and quality of service of the message. At the same time, only the client that subscribes to the topic can receive the corresponding message. When sending the message, the topic and quality of service of the message should be specified and the content of the message should be written.

You can then see the corresponding subscription and publication information in the subscription and publication list.

In topic monitoring, you can also add topic monitoring to view the records of the current published topics, and update the information of the sent and subscribed topics in real time.

The construction and testing of EMQX server is shared here, and the use of EMQX server will be further shared with you later.

For the relevant knowledge of MQTT in the article, those who do not know it can also refer to this blog “On the Hottest Protocol in Internet of Things Development –MQTT Protocol”.

Feel good remember to like attention yo!

Big bad Wolf accompany you to progress together!