Real-Time Communication and Push Notifications
Learn real-time communication protocols and understand which protocol suits different use cases in mobile System Design.
You’re waiting for your Uber driver. You open the app, and the car icon doesn’t move. Five seconds pass. Ten. You start to wonder: Did the app freeze? Is the driver lost?
Even a few seconds’ delay can feel broken in today’s mobile apps. Real-time communication is about speed and trust. Whether messaging a friend, getting stock market alerts, or tracking a delivery, users expect apps to reflect the current reality, not something from a few moments ago. This matters for a number of reasons, listed below.
User experience: Apps feel alive and responsive.
Business outcomes: Faster updates mean happier users and better retention.
Competitive edge: In many markets, the faster app wins.
But building real-time systems on mobile isn’t easy. Phones sleep to save battery, networks fluctuate, and platforms impose background restrictions. Mobile apps must balance instant responsiveness against battery life, reliability, and complexity.
In this lesson, we’ll dive into how mobile systems handle real-time updates, from OS-managed push notifications to full-blown two-way channels like WebSockets and MQTT.
Before exploring custom real-time solutions, let’s examine how mobile operating systems help apps stay updated, often without developers having to build anything fancy.
Operating system’s push notification
When we receive a message on WhatsApp or an alert from our bank app, it is often delivered through a push notification system maintained by the operating system (OS). Instead of requiring each app to maintain its persistent connection to a server, platforms like iOS and Android operate centralized notification services:
Apple Push Notification Service (APNs) for iOS.
Firebase Cloud Messaging (FCM) for Android.
These services manage a small, always-on connection on behalf of all apps on the device, efficiently routing and delivering notification messages. This design dramatically improves device battery life. Rather than every app periodically waking up and checking for updates, the OS handles all communication in a controlled, energy-efficient way. It also ensures that notifications can be delivered even when an app is not running in the foreground, or after the phone has been idle for hours.
Here is a simple illustration for how to register and use push notifications provided by the OS:
However, push notifications also come with important limitations, mentioned below.
No strict real-time guarantee: Delivery may be delayed, especially when the device is in low-power or do-not-disturb modes.
Limited payload size: Push notifications are typically constrained to small messages; larger or dynamic data often requires the app to fetch details separately.
Background execution limits: Due to strict battery-saving policies, apps cannot always perform meaningful work in the background when a push is received, especially on iOS.
Dependency on external services: Apps rely on the reliability and policies of Apple’s or ...