Implementing an MQTT Broker
Written by Sigal Zigelboim   
Friday, 01 March 2024
Article Index
Implementing an MQTT Broker
Getting Started With EMQX

Getting Started With EMQX 

Let’s see how to download, install, and deploy EMQX, a popular open source MQTT broker. This broker provides the following capabilities:

  • Support for MQTT 3.1.0, MQTT 3.1.1, and MQTT 5.0, including MQTT-SN

  • Failover-ready with masterless clustering

  • High concurrency with reduced latency

  • Expandable gateways and plugins

  • HTTP API-driven data integration

You can download EMQX here.

Installing EMQX

You can install EMQX using Docker, EMQX Kubernetes Operator, or install it directly on a physical or virtual machine using a downloadable package. The package supports all popular operating systems including Windows, Linux, macOS, RockyLinux, Ubuntu, and RedHat.

Probably the easiest method to install EMQX is via Docker. Enter the following command in your terminal to download and start the latest version of EMQX. Make sure Docker is installed and running:

docker run -d --name emqx -p 1883:1883 -p 8083:8083 -p 8084:8084 -p 8883:8883 -p 18083:18083 emqx/emqx:latest

Next, open your web browser and type: 

http://localhost:18083/ 

(replacing localhost with your IP address if necessary).

This will take you to the EMQX Dashboard, where you can establish client connections or monitor running status. 

The default login credentials are:

username: admin

password: public

Verifying Connection with MQTTX

Let’s test the connection and message services using MQTTX, a multi-platform MQTT 5.0 desktop client available on macOS, Linux, and Windows.

The following section shows how to verify your connection using MQTTX Web, a browser-based MQTT 5.0 WebSocket client tool. This tool requires no downloads or installations.

MQTTX

To set up the MQTT connection:

  1. Visit the MQTTX Web tool here: https://mqttx.app/web 

  2. Click on + New Connection to navigate to the configuration page.

  3. Name your connection (e.g. MQTTX_Test)

  4. Choose your protocol type from the drop-down list. Note that MQTTX Web only supports the Websockets protocol.

  5. Enter the EMQX broker address, e.g. emqx@127.0.0.1

  6. Fill in the port number (e.g. 8083 for the WebSockets protocol)

  7. Keep the default settings for other fields, or adjust them according to your requirements

  8. Hit the Connect button at the top-right corner of the page

After establishing a successful connection:

  • Subscribe to various topics by clicking on the + New Connection button. MQTTX Web pre-populates some fields to help you subscribe to testtopic/# with a QoS level of 0. Repeat this step to subscribe to more topics, while MQTTX Web assigns color codes to different subscriptions for easier recognition.

  • Evaluate message send/receive functionality. Click the Send button at the chat area's bottom right, and you’ll see successfully sent messages in the chat window above.

MQTTXsq

More Information

EMQX

Related Articles

What Is XDR and How Can It Improve API Security?

Quishing Prevention: How Can Developers Create Secure QR Scanning Apps?

Using ABAC To Secure Your Applications

Endpoint Security for Development Environments

Web Service Security: What You Should Know

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

 

Banner


Ai-Da's Portrait of Alan Turing At Auction
01/11/2024

Sotheby's Digital Art Day Action, now underway, features a large-scale portrait of  Alan Turing created by Ai-Da, the humanoid robot artist whose work, including this canvas, was exhibited at the [ ... ]



Lightbend Announces Akka 3
15/11/2024

Lightbend, the company that developed Akka, has announced Akka 3, and has changed its name to Akka. The company produces cloud-native microservices frameworks, and Akka is used for building distribute [ ... ]


More News

espbook

 

Comments




or email your comment to: comments@i-programmer.info

 

 



Last Updated ( Friday, 01 March 2024 )