What is MQTT in IoT?
This page describes MQTT basics used in IoT(Internet of Things). It mentions MQTT protocol used at session layer in IoT protocol stack. In order to utilize IoT paradigm, interconnected devices need to communicate using lightweight protocols which do not need extensive use of CPU resources. For this, C, Python, Java and MQTT scripting languages are preferable choices useb by IoT applications.
There are two dominant data exchange protocol architectures:
1. Broker based : In this architecture, Broker controls the distribution of information. • It stores, forwards, filters and prioritizes public requests from the publisher client to the subscriber clients. • Clients switch between publisher role and subscriber roles depending on the functionalities desired.
EXAMPLES of broker based protocols:
➤AMPQ: Advanced Message Queuing Protocol
➤CoAP: Constained Aplications Protocol
➤MQTT: Message Queue Telemetry Transport
➤JMS: Java Message Service API
2. Bus based
In this architecture, clients publish messages for a specific topic which are directly delivered to the subscribers of that topic. There will not be any centralized broker or any broker based services here. EXAMPLES of bus based protocols:
➤DDS(Data Distribution Service)
➤REST(Representational State Transfer)
➤XMPP(Extensible Messaging Presence Protocol)
The figure depicts MQTT protocol based architecture.
• MQTT is a lightweight message queueing and transport protocol.
• MQTT as the name suggests is suited for the transport of telemetry data (sensor and actuator data). MQTT is very lightweight and thus suited for M2M (Mobile to Mobile), WSN (Wireless Sensor Networks) and ultimately IoT (Internet of Things) scenarios where sensor and actor nodes communicate with applications through the MQTT message broker.
Examples of the MQTT protocol are as follows:
• Light sensor continuously sends sensor data to the broker.
• Building control application receives sensor data from the broker and decides to activate the blinds.
• Application sends a blind activation message to the blind actor node through the broker.
MQTT Message format:
• MQTT messages contain a mandatory fixed-length header (2 bytes) and an optional message-specific variable length header and message payload.
• Optional fields usually complicate protocol processing.
• However, MQTT is optimized for bandwidth constrained and unreliable networks (typically wireless networks), so optional fields are used to reduce data transmissions as much as possible. MQTT uses network byte and bit ordering.
IoT Wireless Technologies
Links to networking resources
Difference between OSI and TCPIP layers
Difference between TCP UDP
FTP vs HTTP
FTP vs SMTP
FTP vs TFTP
ARP vs RARP
NAT vs PAT
RIP vs OSPF
SLIP vs PPP
IMAP4 vs POP3
IPV4 vs IPV6
Difference between Internet and Intranet