A primer on Eclipse Mosquitto: Difference between revisions

From OPC Labs Knowledge Base
No edit summary
No edit summary
 
(3 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[Category:MQTT Broker]] [[Category:MQTT Broker Primers]] [[Category:Sparkplug]]
<small>Eclipse Mosquitto™ is a trademark of Eclipse Foundation, Inc.</small>
= Introduction =
= Introduction =


Line 39: Line 41:


= See Also =
= See Also =
* [[A primer on Chariot MQTT Server]]
* [[A primer on HiveMQ Broker]]
* [[A primer on HiveMQ Broker]]
* [[A primer on Chariot MQTT Server]]

Latest revision as of 13:05, 20 October 2025

Eclipse Mosquitto™ is a trademark of Eclipse Foundation, Inc.

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.

Remote Access

By default, Mosquitto only allows connections from anonymous clients on the local host. In order to allow anonymous access by remote hosts, use the following in mosquitto.conf:

 listener 1883
 allow_anonymous true

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

WebSockets

In order to allow the MQTT broker be accessed via WebSockets (in this example, also using anonymous connections), use the following in mosquitto.conf:

 # 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.

See Also