A primer on Eclipse Mosquitto: Difference between revisions

From OPC Labs Knowledge Base
No edit summary
Line 18: Line 18:


= Configuration =
= Configuration =
Mosquitto is configured using the <code>mosquitto.conf</code> file in its installation directory.


Mosquitto is configured using the <code>mosquitto.conf</code> file in its installation directory.
== WebSockets ==
Use the following in mosquitto.conf:
 
  listener 1883
  allow_anonymous true
 
  # this will expect websockets connections
  listener 8080
  protocol websockets
  allow_anonymous true
 
Restart the "Mosquitto Broker" service after making the configuration change, and possibly open the firewall port as needed.

Revision as of 09:41, 1 August 2025

Introduction

Eclipse Mosquitto™ is an open source MQTT broker.

Web site: https://mosquitto.org/

Download: https://mosquitto.org/download/

Documentation: https://mosquitto.org/documentation/

Public broker: https://test.mosquitto.org/

Installation

On Windows, the setup program (by default) installs a Windows service named "Mosquitto Broker". The service is set to start automatically, and is running when the installation completes, thus the MQTT broker can be used immediately. The service can easily be controlled (started, restarted, stopper) from the Services management console.

The installation directory is usually "C:\Program Files\mosquitto".

Configuration

Mosquitto is configured using the mosquitto.conf file in its installation directory.

WebSockets

Use the following in mosquitto.conf:

 listener 1883
 allow_anonymous true
 # this will expect websockets connections
 listener 8080
 protocol websockets
 allow_anonymous true

Restart the "Mosquitto Broker" service after making the configuration change, and possibly open the firewall port as needed.