1
724views
Explain in detail MQTT Protocol
1 Answer
1
46views

MQTT (Message Queuing Telemetry Transport)

  • MQTT is a M2M (Machine-To-Machine) connectivity protocol.
  • MQTT is based on Publisher/Subscriber model.
  • It was created to connect to the systems situated in remote place and to get data from those sensor.
  • Decoupling can be done because of Publisher/Subscriber model which is hard to achieve in Client/Server model.

MQTT Components

MQTT has 3 basic components

  • Publisher (e.g. Motor, Mobile Devices, etc.)
  • Subscriber (e.g. Temperature sensor, Motion Sensor, etc.)
  • Broker

enter image description here

MQTT Publisher

  • System or sensors which collects data and send it to the broker which further sends it to multiple subscribers.
  • Example motion sensor, water level sensor, etc.
  • Publisher publish data in following formats
    • Binary
    • JSON
    • SDC Record
    • Text

MQTT Subscriber

  • Subscriber can be a mobile device, data server, monitoring stations, etc. which receives publish data from broker so that it can act according to it or monitor it or store it.
  • Subscriber send request to broker to send required publisher’s data.
  • Broker has the table in which it maintains all subscriptions request, and send publish data according to it.
  • Example Mobile devices, Monitoring system, etc.

MQTT Broker

  • Broker is the component which take care of receiving data from Publisher and sending it to Subscriber accordingly.
  • Broker has to filter messages, broker can filter messages in following ways.
    • Subject based
    • Content based
    • Type based
  • Broker has a subscription table in which it store all the request from the subscriber for the publisher’s data.
  • Broker sends publish data to multiple subscriber according to this list.

enter image description here

Decoupling in Pub/Sub

  • Space decoupling:- In MQTT there no need for publisher and subscriber to know each other, since it is Pub/Sub model there no need to exchange IP address.
  • Time decoupling:- Since it is Pub/Sub model there is no need for publisher and subscriber to run on same time.
  • Synchronization decoupling:- Operations on both publisher and subscriber do not need to be interrupt during the publishing and receiving.
Please log in to add an answer.