MQTT
Protocol with QoS and low bandwidth requirements
Client
E.g. sensor connected to a Raspberry Pi. The client registers with the Broker over TCP on ip:port
Broker
The relay in the middle that sends the messages to the right recipients
The 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 action
Python
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