AI & Automation

MQTT vs HTTP for IoT: Which Protocol Should Your Devices Use

November 11, 2026 · 5 min read · Etzal Group Team

Every connected device has to send its readings somewhere, and the first design decision is how. Two protocols dominate. HTTP is what browsers and most business software speak. MQTT is a lightweight messaging protocol created for telemetry over unreliable networks. The MQTT vs HTTP choice affects battery life, data cost, how quickly you can command a device and how the system behaves when the network misbehaves.

How each one works

HTTP is request and response. The device opens a connection, sends a request containing its data, receives an answer and usually closes the connection. Each exchange carries headers that describe the request, often larger than the reading itself.

MQTT is publish and subscribe through a broker. The device opens one connection and keeps it. It publishes small messages to named topics, such as site1/pump3/pressure. Any system subscribed to that topic receives the message. The device can also subscribe to topics to receive commands.

Bandwidth and data cost

A temperature reading is a few bytes. Wrapped in HTTP it becomes hundreds of bytes per message, plus the cost of setting up a secure connection each time. Over a mobile network with thousands of devices reporting every minute, that overhead is a real monthly bill.

MQTT's fixed header is two bytes, and the connection stays open, so the secure handshake happens once. For frequent small messages it uses a fraction of the data.

If a device reports once an hour over Wi-Fi, the difference is negligible. If it reports every few seconds over cellular, it matters.

Power

Radio time is what drains a battery. Establishing a new secure connection for every reading keeps the radio on longer. A persistent MQTT connection, or a very short burst that publishes and sleeps, uses less.

For devices that wake rarely and sleep deeply, the cost of reconnecting can favour a single HTTP request, or a protocol designed for constrained networks. Measure with the real hardware and network before deciding.

Unreliable networks

Field connections drop. MQTT includes features for this:

  • Quality of service levels. Level 0 sends once with no confirmation. Level 1 confirms delivery and may deliver twice. Level 2 guarantees exactly once at the cost of more exchanges.
  • Retained messages. The broker keeps the last value on a topic for new subscribers.
  • Last will. If a device disappears without closing its connection, the broker publishes a message saying so. This gives you offline detection for free.
  • Persistent sessions. Messages for a temporarily offline device are held until it returns.

With HTTP you build these behaviours yourself: retries, duplicate handling and a way to detect that a device has gone silent.

Sending commands to devices

This is where the two differ most. A device behind a mobile network or a firewall cannot be reached from outside. With HTTP, the device has to ask periodically whether there is anything to do, which adds delay and traffic. With MQTT, the device is already connected and subscribed, so a command arrives within moments.

If you need to open a valve, change a setpoint or trigger a reading on demand, MQTT makes that natural.

Where HTTP is the better choice

  • Infrequent reporting from devices with reliable power and network.
  • Large payloads, such as images, files and firmware.
  • Simple integration. Every platform, firewall and developer understands HTTP, and there is no broker to run.
  • Direct calls to a business API, where a device posts a transaction such as a completed delivery.
  • Environments where only web traffic is permitted through the network.

Where MQTT is the better choice

  • Many devices sending small messages often.
  • Constrained links: cellular, satellite, low bandwidth.
  • Battery-powered devices with frequent reporting.
  • Two-way control with low delay.
  • Several consumers of the same data, such as a dashboard, an alarm service and a historian.

Security for either

  • Encrypt with TLS. Plain connections expose data and credentials.
  • Give each device its own identity, by certificate or unique credentials. Never share one password across a fleet.
  • For MQTT, restrict each device to its own topics so that one compromised unit cannot read or command the others.
  • Plan how credentials are replaced when a device is lost or retired.
  • Keep the broker or endpoint updated and monitored.

Design points that matter more than the protocol

  • Buffer locally. Store readings with timestamps while offline and send them later.
  • Structure topics or endpoints clearly, by site, asset and measurement.
  • Use a consistent message format with units and timestamps.
  • Handle duplicates on the receiving side.
  • Monitor the fleet: last seen time, signal strength, battery level.

A simple rule

Use MQTT when devices are many, messages are small and frequent, the network is unreliable, or you need to command devices quickly. Use HTTP when messages are rare or large, the network is good, and simplicity is worth more than efficiency. Use both when a system has both kinds of traffic.

Protocol selection, broker setup and device fleet monitoring are part of our IoT and Control projects. If your devices lose data whenever the signal drops, tell us how they are connected today.

Summary

HTTP is simple and universal, and heavy for constant small messages. MQTT is efficient, handles poor links and supports commands, at the price of running a broker. Whichever you choose, encrypt, give each device its own identity, buffer data on the device and watch the health of the fleet.

Frequently asked questions

Is MQTT more secure than HTTP?

Neither is secure by default. Both rely on TLS for encryption and on proper authentication of each device. MQTT adds a broker that must be configured so that a device can publish and subscribe only to its own topics. A misconfigured broker is a common weakness.

Can a device use both MQTT and HTTP?

Yes, and many do. MQTT carries frequent telemetry and commands, while HTTP is used for occasional large transfers such as firmware downloads or uploading a log file. Each protocol does what it suits.

What happens to data when the connection drops?

That depends on the device, not only the protocol. A well-designed device stores readings locally while offline and sends them when the link returns, with their original timestamps. MQTT's delivery levels help in transit, and local buffering is still needed for longer outages.

Author

Etzal Group Team

Etzal Group Team, helping businesses grow with technology. Contact us.

Related service

WhatsApp AI Chatbot

We build, train, and run a WhatsApp AI agent that answers customers 24/7, qualifies leads, and follows up.