technology

Pulse: Building resilient MQTT infrastructure for Android at Zomato

Manik GuptaIJune 23, 2026I4 mins read
Pulse: Building resilient MQTT infrastructure for Android at Zomato

Real-time updates have become the default expectation in modern apps. Whether tracking a cab, following a live sports score, or monitoring an online order, users notice latency becomes noticeable almost instantly. When a user opens the live tracking screen on Zomato, they expect to see the delivery partner moving steadily across the map, ETAs recalculating as they go, and order statuses changing in near real time. Behind this straightforward  experience lies a constant stream of location updates and delivery events flowing across unstable mobile networks, battery optimisations, and OS’s background execution limits.


Real-Time Systems in Motion

A delivery partner app continuously generates time-sensitive events:

  • Live location updates
  • Delivery lifecycle events

These power live tracking, ETA calculations, customer notifications, merchant visibility, and internal logistics coordination. Unlike consumer apps that remain active for a few minutes, delivery partner apps often run for several hours at a stretch, which demands far more than keeping a connection open.


When HTTP Polling Started Breaking at Scale 

Like many teams building such systems, we began with periodic HTTP polling. It worked early on, but the inefficiencies grew with scale. Most delivery updates are tiny payloads, yet every HTTP request carries repeated connection setup, Transport Layer Security (TLS) handshakes, headers, and protocol overhead. In many cases, the overhead outweighed the payload itself. Polling also introduced latency. Even short intervals made live tracking feel less fluid, with delayed ETAs and rider markers that jumped rather than moved. We needed a communication model that was lightweight, persistent, and better suited for unreliable mobile environments.

Image


MQTT Solved Networking, Not Reliability

We moved towards MQTT, a publish-subscribe protocol designed for low-bandwidth and unreliable networks.

Instead of repeatedly creating short-lived HTTP connections, MQTT maintains a persistent connection through which updates can be pushed instantly. This significantly reduced protocol overhead while improving latency. But we quickly realised that choosing the protocol was only part of the problem.The challenge was ensuring real-time communication reliability on mobile devices operating under real-world production conditions : networks dropping or switching between WiFi and mobile data, OEM battery optimisation, and background execution limits.

As the same issues surfaced across other use cases internally, we needed a consistent way to handle connectivity, recovery, retries, and lifecycle management.


Introducing Pulse-MQTT 🥁 ⚡️

Pulse-MQTT,  is an Android library for creating and managing MQTT connections, built on top of Eclipse Paho. It is not a wrapper around an MQTT client. It is built for the operational side of running long-lived real-time connections on Android. Internally, operations such as CONNECT, SUBSCRIBE, and PUBLISH run through a command queue, enabling ordered execution and safer recovery during reconnects.

Some of the features that Pulse offers:

  • Auto reconnection and recovery: restores connectivity and subscriptions during network interruptions.
  • Configurable retry policies : supports intelligent retry strategies like exponential and sequential retries for failed operations.
  • Command dependencies ensure critical commands execute in the correct order, such as connecting before subscribing.
  • Health monitoring: checks connection health using WorkManager or AlarmManager.
  • Network monitoring support:  detects network state changes and adapts to connectivity fluctuations.
  • Android first design: built specifically to integrate seamlessly with Android’s lifecycle model and support long-running background sessions.

Image

Today, Pulse-MQTT runs in production across the Delivery Partner, Consumer, and Hyperpure apps.


Open Sourcing Our Learnings 

Today, Pulse reflects what we have learnt operating large-scale real-time systems on Android in production. We are now open sourcing it for the Android community.

Do checkout the repository on GitHub and star it if you find it useful.

Documentation: https://zomato.github.io/pulse-droid/

This blog was authored by Manik Gupta. The work described was carried out by Manik Gupta and was done under the guidance of Amritpal Singh