Home of RF and Wireless Vendors and Resources

One Stop For Your RF and Wireless Need

MQTT vs HTTP | Difference between MQTT and HTTP protocols

This page compares MQTT vs HTTP and mentions difference between MQTT and HTTP protocols. It mentions functional difference between MQTT bridge and HTTP bridge.

Introduction: IoT devices can connect and communicate with IoT cloud core using two protocols viz. MQTT and HTTP. For communication with cloud core, IoT devices require MQTT bridge or HTTP bridge. This is configured in device registry during device creation.

What is MQTT Bridge ?

MQTT is standard publish/subscribe protocol which is used by embedded devices. It is also used as common M2M interactions. In this device connection is maintained and it uses full duplex TCP connection.

Broker based MQTT protocol

The figure-1 depicts simple MQTT protocol architecture (broker based). Following are the features of MQTT protocol:
• It is over TCP.
• It uses SSL/TLS for security.
• There are many messages used in MQTT protocol such as CONNECT, PUBLISH, SUBSCRIBE, DISCONNECT etc.
• Username/Password is used in 'connect' message.
• It encrypts payload i.e. it is payload agnostic.
• 1883 port is used by MQTT protocol.

Following are the features of MQTT protocol.
• Lower usage of bandwidth
• Low latency
• High throughput
• Supports raw binary data

Refer MQTT Protocol basics >>, MQTT tutorial >> and advantages and disadvantages of MQTT >>.

What is HTTP Bridge ?

HTTP is connectionless protocol in which connection is not maintained with cloud core. HTTP protocol sends requests and receive responses. Cloud core supports selected versions of the HTTP protocol.

HTTP connection

The figure-2 depicts, HTTP connection between client (web user) and web server. It uses normal IP header for routing of packets and data are not encrypted before transmission.

Following are the features of HTTP protocol.
• It is light in weight.
• It causes few firewall issues.
• In HTTP protocol, binary data must be base64 encoded. This requires more CPU and network resources.

Refer difference between HTTP vs HTTPS >> and advantages and disadvantages of HTTP >> for more information.

Tabular Difference between MQTT and HTTP

Both MQTT and HTTP bridges use public key device authentication and JWTs (JSON Web Tokens). JWT is transmitted in "password" field of "CONNECT" message in MQTT protocol where as JWT is transmitted in "Authorization" header of "HTTP Request" message. In both protocols, telemetry events are pushed to the cloud Publish/Subscribe. Following table mentions difference between MQTT and HTTP protocols.


Features MQTT HTTP
Full Form Message Queue Telemetry Transport Hyper Text Transfer Protocol
Design Methodology The protocol is data centric. The protocol is document centric.
Architecture It has publish/subscribe architecture. Here devices can publish any topics and can also subscribe for any topics for any updates. It has request/response architecture.
Complexity simple more complex
Data security YES NO, hence HTTPS is used to provide data security.
Upper layer protocol It runs over TCP. It runs over UDP.
message size small, it is binary with 2Byte header. Large, it is in ASCII format.
Device Connection Status It is reported. It is not reported.
Service levels 3 1
Libraries 30KB C, 100KB Java Large
Port number 1883 80 or 8080
Data distribution 1 to 0/1/N one to one only


Difference between MQTT and REST, DDS, SMQTT and CoAP protocols

MQTT vs REST    MQTT vs DDS    MQTT vs SMQTT    MQTT vs CoAP   


IoT Wireless Technologies

WLAN    THREAD    EnOcean    LoRa    SIGFOX    WHDI    Zigbee   6LoWPAN   Zigbee RF4CE   Z-Wave   NFC   RFID   INSTEON  



What is difference between

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 

RF and Wireless Terminologies


Share this page

Translate this page