MQTT
Introduction:
It is message broker which holds the data when ever a consumer will connected to the topic then he will receive the data . mqtt is a machine to machine message broker, mainly used in IOT application, the default port is 1883
Installation:
sudo apt-get update
sudo apt-get install mosquitto
Command line execution:
Producer
mosquitto_pub -h 127.0.0.1 -t 'topic_name' -m '{'name':'Sony'}'
Subscriber
mosquitto_sub -h 127.0.0.1 -t 'topic_name'
-h : it is the host address
-t : topic name
-m : message payload
QOS in MQTT:
QOS(quality of services) there are mainly 3 services are available in mqtt
- qos=0
- qos=1
- qos=2
QOS (0,0):
At most once service, publisher will send a message to broker at most once, the broker passes a message to subscriber one time
Comments
Post a Comment