Home>Posts>Industrial IoT, Tech Explained>Connecting the IoT: A Quick Look at MQTT and CoAP Protocols

Connecting the IoT: A Quick Look at MQTT and CoAP Protocols

By ·Categories: Industrial IoT, Tech Explained·Published On: November 7th, 2016·3 min read·

Every day about 5.5 million new devices join the ranks of the Internet of Things (IoT). By 2020, research firm Gartner expects some 20.8 billion connected devices – ranging from DVRs and home thermostats, to embedded factory controllers – will be deployed, up from about 6.4 billion this year.

Getting those billions of devices to interact is no small feat, especially when you consider the unique character of many IoT devices, which are often small, remotely deployed and infrequently serviced. These devices are also often network-constrained and limited in both computing resources and power consumption. So any system designed to let IoT devices interact must be smart, efficient and economical. Today, two widely adopted protocols address IoT data connectivity: Message Queuing Telemetry Transport (MQTT) and Constrained Application Protocol (CoAP). Let’s take a look at some of the strengths and weaknesses of each.

What is MQTT?

MQTT is a messaging protocol designed for lightweight machine-to-machine communication. Developed in 1999 by IBM to enable a supervisory control and data acquisition (SCADA) system for a remote pipeline project, MQTT has evolved into an open standard maintained by the OASIS standards body. MQTT follows a publish/subscribe message exchange pattern, in which devices create topics at a central broker that client devices can then subscribe to. When a device sends a message related to a specified topic, the message is pushed to any client subscribed to it. The centralized broker architecture can simplify management, help ensure delivery, and ease the challenge of IoT devices communicating across firewalls. Running over TCP, MQTT conversations can be secured using the same SSL/TLS scheme employed for web sites, though it is considered too heavyweight for many constrained scenarios.

What is CoAP?

CoAP, on the other hand, is a new standard developed by the IETF Constrained Resource Environments (CoRE) group that is often described as a lightweight analog to HTTP. Highly scalable and REST-savvy, CoAP trades off the transmission guarantees of TCP (used by MQTT) for the smaller packets and lower overhead of UDP. CoAP employs a client-server model and request/response message pattern, where client devices send information requests directly to server devices, which then respond. Support for an Observer message pattern enables clients to receive an update whenever a requested state changes, for example a valve opening or closing, while confirmed message delivery provides some level of assurance under the connectionless UDP transport.

At the end of the day, the decision of what protocol to adopt depends entirely on the specifics of your particular device deployment. In some cases, the hub-and-spoke, brokered architecture of MQTT may offer advantages, while in others the decentralized approach employed by CoAP may be best. In the same vein, CoAP’s UDP foundation is generally friendlier to battery-powered devices, while MQTT based on TCP can offer greater assurance of message delivery.

Here are some of the key distinctions between these two popular protocols at a glance.



Established1999 (2013 OASIS standard)2014
Messaging PatternPublish/subscribe via message brokerRequest/response (client-server)
TransportTransmission Control Protocol (TCP)User Datagram Protocol (UDP)
SecuritySSL/TLS over TCPDTLS over UDP
StrengthsBroker architecture can simplify management; TCP and quality of service options enable robust message deliveryFast and efficient due to reliance on low-overhead UDP; RESTful model is welcoming to developers and provides for integrated resource discovery
WeaknessesAlways-on TCP connections limit utility for low-power devices; SSL/TLS encryption a poor match for constrained clientsLacks the reliability and service guarantees of TCP-based MQTT

Regardless of whether you choose MQTT or CoAP IoT protocols, you’ll need the right hardware. Click below to explore our full line of versatile, highly reliable industrial PCs, ideally suited for IIoT deployments.

Get the Latest Tech Updates

Subscribe to our newsletters to get updates from OnLogic delivered straight to your inbox. News and insights from our team of experts are just a click away. Hit the button to head to our subscription page.


About the Author: Darek Fanton

Darek is the Communications Manager at OnLogic. His passion for both journalism and technology has led him from the newsrooms of local papers to the manufacturing floor of IBM. His background in news gathering has him always on the lookout for the latest in emerging tech and the best ways to share that information with readers. In addition to his affinity for words, Darek is a music lover, juggler and huge fan of terrible jokes.