# MQTT Overview

An installation of MQTT broker is necessary to publish messages from the Atlas Copco Data Communication. In the following setup, the MQTT broker used is Eclipse Mosquitto but any broker that supports MQTT v5 and QoS level 2 (Exactly Once) can be used.

## Setting Up the Mosquitto MQTT Broker

Follow these steps to install and configure the Mosquitto MQTT Broker with support for MQTT v5.

1. Install the Mosquitto MQTT Broker

   1. Download the Mosquitto installer from the official website: https://mosquitto.org/download

   2. Select version 1.6.0 or later to ensure compatibility with MQTT v5.

   3. Run the installer and follow the on-screen instructions.

2. Configure the Authentication

   1. Open Command Prompt as an administrator.

   2. Navigate to the Mosquitto installation directory: `cd "C:\Program Files\mosquitto"`

   3. Create a password file using the following command: `mosquitto_passwd.exe -c passwd.txt acdcuser`

   4. When prompted, enter the desired password. This creates a passwd.txt file in the Mosquitto directory.

3. Update the Mosquitto Configuration

   1. Open the mosquitto.conf file located in: `C:\Program Files\mosquitto`

   2. Add the following lines to the configuration file:

      `allow_anonymous falsepassword_file`

      `C:\Program Files\mosquitto\passwd.txt`

   3. Save and close the file.

4. Restart Mosquitto Broker Service

   1. Open the Services application (services.msc) and restart the Mosquitto Broker service.

5. Verify the MQTT version

   1. Open Command Prompt and run the following command:

      `mosquitto -h`

   2. The expected output is similar to:

      `mosquitto is an MQTT v5.0/v3.1.1/v3.1 broker.`