Install MOSQUITTO

Nyamuk-nyamuk... beneran ini sebenernya server. bukan nyamuk beneran, karena sangat ringan maka disebut mosquitto

Install karena sangat berguna.


sudo apt-add-repository ppa:mosquitto-dev/mosquitto-ppa
sudo apt-get update 
sudo apt-get install mosquitto python-mosquitto
sudo apt-get install mosquitto-clients


ngetest


mosquitto_pub -d -t hello/world -m "Hello, MQTT. This is my first message."

mosquitto_sub -d -t hello/world
Kalau dari python seperti ini:
import mosquitto
mqttc = mosquitto.Mosquitto("python_pub")
mqttc.will_set("/event/dropped", "Sorry, I seem to have died.")
mqttc.connect("127.0.0.1", 1883, 60, True)

mqttc.publish("hello/world", "Hello, World!") 

0 komentar:

Posting Komentar