Concepts
Publish/Subscribe
- Device 1 publishes a topic
- Device 2 is subscribed to the same topic in which device 1 is publishing in
- Device 2 receives the message
Messages: command or data
- Topics
- Interest for incoming messages
- Specify where you want to publish
Topics are represented with strings separated by slashes “/“
Slashes indicate the topic level
Topics are case sensitive
Broker
- Receives all the messages
- Filters the messages
- Publishes the messages to all subscribed clients
QoS (Quality of Service)
- QoS 0: Fire and Forget ( I said it is enough)
- QoS 1: At Least One (A: Hello, … wait till B: Yes I hear you)
- QoS 2: Exactly Once (A: Hello, … wait till B: Yes I hear you, A: Good, I won’s say again…B: Wonderful conversation)
QoS only applies to connected clients. If client is not connected, they’ll never receive the message. Retained Message: MQTT broker stores that message and sends it to any new subscribers.