How to set up Eclipse Mosquitto MQTT Broker and connect a client

How to set up Eclipse Mosquitto MQTT Broker and connect a client

Community Manager
Community Manager

In this How-to we will cover the first steps in connecting a client to your Mosquitto broker.

What you need
  • An installation of the Mosquitto Broker on your ctrlX CORE
  • A valid license
  • The MQTT Explorer

For a quick introduction to Mosquitto click here.

First steps

After your installation, Mosquitto is available over your Navigation Menu on the left side of your Browser. Click it and open the “Management Center”.

NavBar MosquittoNavBar Mosquitto

The Management Center (MMC) allows managing Mosquitto via a Browser UI.
Gather real time information of your broker and set up the dynamic security. If you are used to working with a terminal, there is one embedded in the MMC.

To get started with a connection, you first need to create a client. Use the left side navigation and click on “Clients”. As you can see, there are no existing clients. Create one and click “Save”.

Create a ClientCreate a Client

Clients need permissions to operate. These are administered via “Roles”. Without any assigned role, a client is not able to perform any action on Mosquitto. There are a couple of prebuild roles, which you can choose from, or you can create your own.

For now, choose the role “client”, which allows full publish and subscribe capabilities. Now, we are already set to connect to Mosquitto.

Client Role SelectionClient Role Selection

Open the MQTT Explorer, use the IP of your CORE and the port 8883 to connect.
Choose TLS on and uncheck the “Validate certificate” option.
Don´t forget to use the username and password from the client you just created.

MQTT ExplorerMQTT Explorer

When the connection is established, you can now send data to a topic and see it arrive in your MMC topic tree. Use the right side of the MQTT Explorer to set a topic and a payload to be send. After sending it, you are able to see it in the topic tree of your MMC.

MMC ExplorerMMC Explorer

Related Links

The Company

Cedalo AG is an IoT start-up based in Freiburg, Germany, that is truly devoted to Open Source. Our products constitute of Eclipse Foundation projects. Eclipse Streamsheets, the first product, is a no-code application platform which can easily subscribe and publish to data streams like MQTT or Apache Kafka. Business process users can build stream processing applications using a spreadsheet GUI and cell functions. A variety of diagram types provides fast dashboarding. Eclipse Mosquitto, the second product, is the most downloaded MQTT broker worldwide. Brokers orchestrate the data flow in modern IoT publish/subscribe architectures. Mosquitto excels in big installs on servers due to a high efficiency to handle a large number of parallel connections. However, its resource-friendly programming makes it ideal for usage on small ARM-based edge devices like the Raspberry Pi, as well.
Cedalo GmbH

Hi, I am Katja a member of the ctrlX AUTOMATION Community team. Feel free to reach out if you need any support.
Must Read