Categories
Uncategorized

Setting/up/MQTT/Broker mosquitto

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

Windows:
mosquitto-1.6.12a-install-windows-x64.exe (example)

Select Files and Service

To start the service, Computer Management (right-click on My Computer, Manage) -> Services and Applications->Services->Mosquitto Broker->right click->Start

(You can also set the service to Automatic in right click on the service->Properties->Startup type)

If not run as a service, you can start it with
C:\”Program Files”\mosquitto\mosquitto.exe -v -c “C:\Program Files\mosquitto\mosquitto.conf”

To test, run:
C:\Program Files\mosquitto\mosquitto_sub -h localhost -v -t “TxNamib/#”

If the service is not running or accessible, the error wil show:
Error: No connection could be made because the target machine actively refused it.

Else, you will only see a message if it was “retained”, or you publish something to TxNamib now
C:\”Program Files”\mosquitto\mosquitto_pub -h localhost -t “TxNamib/servo.2003/03” -r -m “CLOSED”
or
C:\”Program Files”\mosquitto\mosquitto_pub -h localhost -t “TxNamib/servo.2003/03” -r -m “THROWN”

Ubuntu and Raspberry Pi (3, 4, 400 and Zero W):
sudo apt-get install mosquitto

or

snap install mosquitto

Older versions of Ubuntu:
sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt-get update