IoT Connectivity Protocols Compared: MQTT, HTTP, CoAP, and More
A practical comparison of IoT communication protocols to help you choose the right one for your project.
Choosing the Right IoT Protocol
One of the most important decisions in any IoT project is selecting the communication protocol. The right choice depends on your power constraints, bandwidth availability, latency requirements, and scale.
Protocol Overview
Here's a quick comparison of the most common IoT protocols:
| Protocol | Transport | Best For | Power Usage | |----------|-----------|----------|-------------| | MQTT | TCP | Telemetry, sensors | Low | | HTTP/REST | TCP | Web integration | Medium-High | | CoAP | UDP | Constrained devices | Very Low | | WebSocket | TCP | Real-time bidirectional | Medium | | LoRaWAN | RF | Long-range, low-power | Very Low | | Zigbee | RF | Short-range mesh | Low |
MQTT — The IoT Workhorse
MQTT (Message Queuing Telemetry Transport) is the most widely used IoT protocol, and for good reason:
- Lightweight — Minimal overhead, small packet size
- Publish/Subscribe model — Decouples senders from receivers
- QoS levels — Choose between fire-and-forget (0), at-least-once (1), or exactly-once (2)
- Retained messages — New subscribers get the last known value immediately
# MQTT topic structure example
sensors/building-a/floor-1/temperature
sensors/building-a/floor-1/humidity
devices/router-01/status
MQTT is ideal for sensor data collection, device telemetry, and any scenario where you need reliable message delivery with low bandwidth.
HTTP/REST — When Simplicity Wins
HTTP is familiar and well-supported everywhere. It's a good choice when:
- Your devices have sufficient power and bandwidth
- You need to integrate with existing web APIs
- Request-response patterns match your use case
- You're prototyping and want quick results
The downside is higher overhead per message compared to MQTT.
CoAP — For Constrained Devices
CoAP (Constrained Application Protocol) is designed specifically for resource-limited IoT devices:
- Runs over UDP (lower overhead than TCP)
- RESTful design similar to HTTP
- Built-in discovery mechanism
- Supports multicast
Use CoAP when your devices have very limited memory, processing power, or battery.
LoRaWAN — Long Range, Low Power
For sensors deployed across large areas (farms, cities, industrial sites):
- Range of 2-15 km depending on environment
- Extremely low power consumption
- Low data rate (suitable for periodic sensor readings)
- Requires a LoRa gateway
How I Choose
In my IoT projects, I follow this decision tree:
- Need long range outdoors? → LoRaWAN
- Constrained battery device? → CoAP or MQTT with QoS 0
- Real-time bidirectional? → WebSocket or MQTT
- Simple web integration? → HTTP/REST
- General telemetry at scale? → MQTT
Conclusion
There's no one-size-fits-all protocol for IoT. Understanding the tradeoffs between power, bandwidth, latency, and complexity helps you make the right choice for each specific project.
More IoT deep dives coming soon on TechSystems Lab!