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


A Swarming Bee From Festo
12/05/2024

The latest addition to the Festo Bionic Learning Network menagerie of bionic robots inspired by the natural world is a bee. Like the Bionic Ant from a decade ago, it has been designed n [ ... ]



Pharo 12 Adds New Breakpoint System
09/05/2024

The latest version of Pharo, the open-source Smalltalk-inspired language and core library adds a new breakpoint model based on the debug point system.


More News

raspberry pi books

 

Comments




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

 

 



Last Updated ( Friday, 01 March 2024 )