Date Category notes Tags mqtt

To get started with MQTT was quite simple.

I installed Mosquitto MQTT broker and its clients on my (Ubuntu) Linux laptop which I will use as my MQTT server for now:

$ sudo apt-get install mosquitto
$ sudo apt-get install mosquitto-clients

Mosquitto started automatically after installation. I checked its status to confirm it’s running:

$ sudo service mosquitto status
mosquitto start/running, process 808

I left Mosquitto configuration as-is for now. For any future reference, the config is at /etc/mosquitto/mosquitto.conf.


Installed mosquitto-clients provide two binaries that make testing and playing with MQTT really simple.

I ran a test topic subscribe in one terminal window and I published hello world message to the test topic from second terminal window.

In the first terminal, using mosquitto_sub I can subscribe to any topic (note, topics do not need to be pre-defined/configured first):

$ mosquitto_sub -t test

In the second terminal, using mosquitto_pub I can publish a message to any topic:

$ mosquitto_pub -t test -m "hello world"

The published message pops up in the first window:

$ mosquitto_sub -t test
hello world

It’s really that simple.

Further notes are at my EtherMega MQTT Node