Mosquitto is a lightweight open source message broker that Implements MQTT versions 3.1 and 3.1.1.
It is written in C by Roger Light, and is available as a free download for Windows and Linux and is an Eclipse project.
The main website is here.
Installing The Broker
To use it you will first need to install it.
- How to Install The Mosquitto MQTT Broker on Linux (Ubuntu)
- How to Install The Mosquitto MQTT Broker on Windows
Starting and Stopping The Broker
Depending on the install it will probably be started automatically on system startup.
On Windows you can stop the service if it is running by using the control panel>admin>services.
You can also the net command:
net stop mosquitto
On Linux use:
sudo service mosquitto stop
Starting from command line is the best option when testing and to do that use:
Windows and LInux
mosquitto -v #start in verbose mode
To see other start options use:
By default the broker will start listening on port 1883. You can change that by editing the configuration file-mosquitto.conf See Quick Guide to The Mosquitto.conf File With Examples
Alternatively you can use a command line switch to specify the port e.g.
mosquitto -p 1884
You can run Multiple brokers on the same machine by starting them on different ports See this video- on running multiple brokers.
Mosquitto Client Scripts
The mosquitto install includes the client scripts.
There is a simple subscriber client
and a publisher client
They are useful for some quick tests. See Using The Mosquitto_pub and Mosquitto_sub Client Tools- Examples
- Understanding and Configuring Logging – Mosquitto Broker Configuration
- Mosquitto Username and Password Authentication -Configuration and Testing
- Mosquitto SSL Configuration -MQTT TLS Security
- Mosquitto MQTT Bridge-Usage and Configuration
- Configure Mosquitto Bridge With SSL Encryption- Examples
- Configuring and Testing Mosquitto MQTT Topic