MQTT
Protocol with QoS and low bandwidth requirementsClient
E.g. sensor connected to a Raspberry Pi. The client registers with the Broker over TCP on ip:portBroker
The relay in the middle that sends the messages to the right recipientsThe Client registers with broker and the Subscriber registers with the broker too.
The broker forwards the messages from the the client/sensor to the Subscriber
Install on Raspberry Pi
If you just run the following commands on the Raspberry Pi the broker will be installed:
sudo apt-get install mosquitto
sudo update-rc.d mosquitto defaults
sudo /etc/init.d/mosquitto start
Now the mosquitto server runs on port 1883 on localhost
Subscriber
The unit that needs the data from the sensor to perform the actionPython
Python uses the Paho implementation and the Mosquitto version has been deprecated, get the current Paho implementation from pip:https://pypi.python.org/pypi/paho-mqtt
Install:
sudo pip install paho-mqtt