MQTT vs REST | Difference between MQTT and REST Protocols
This page compares MQTT vs REST and mentions difference between MQTT and REST protocols.
The figure-1 depicts MQTT architecture. MQTT is the short form of Message Queue Telemetry Transport. As shown it consists of centralized broker where in all communications between
end devices go through the broker. The broker can be installed on any public server.
MQTT is based on publish/subscribe architecture, where in each end devices can publish topic as well as
they can subscribe for any topic. It is built on TCP protocol. Here connection is established before the communication.
In MQTT protocol, Username and password is needed to establish the connection.
Refer MQTT Protocol>> for more information.
The figure-2 depicts REST protocol stack. REST is the short form of Representational State Transfer. As shown it is built on HTTP/TCP layers. The REST protocol uses bus based architecture, where in no broker component is needed and end devices can communicate directly. In this request and response messages are used between end devices to exchange the information.
Following table mentions comparison between MQTT and REST protocols.
|Full Form||Message Queue Telemetry Transport||Representational State Transfer|
|Messages used||Connect, connect ack, publish, publish ack, subscribe, subscribe ack, disconnect etc.||GET, PUT, POST and DELETE|
|Need of centralized broker||required, end devices communicate via broker||not required, end devices direct communicate|
|fault tolerance||broker in SPoF||server in SPoF|
|scope||device to cloud
cloud to cloud
| device to cloud
cloud to cloud