Compared to Hypertext Transfer Protocol (HTTP), it focuses to transfer data.
sudo apt-get install mosquitto
sudo apt-get install mosquitto-clients
pip install paho-mqtt
mosquitto_sub -t "test" # T1 to create a topic named test
mosquitto_pub -m "message from mosquitto_pub client" -t "test" # T2
import paho.mqtt.client as mqtt
host = 'localhost'
client = mqtt.Client()
client.connect(host,keepalive=60)
client.loop_start()
client.publish('test','testing 1')
client.loop_stop()
client.disconnect()