A primer on Eclipse Mosquitto: Difference between revisions
| Line 21: | Line 21: | ||
== Remote Access == | == Remote Access == | ||
By default, Mosquitto only allows connections from clients on the local host. In order to allow access by remote hosts, use the following in mosquitto.conf: | 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 | listener 1883 | ||
Revision as of 09:59, 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.
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, 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.