Lesson 13 of 14
❮Prev Next❯

MSD-101 · Deep dives: hard problems, solved

Push notifications that arrive

⏱ 11 min 🎮 Hands-on ☁ Azure

13of 14

Your note

My notes for this lesson

Select any text in the lesson to highlight it or add a note. Saved in this browser.

    No highlights yet. Select a sentence in the lesson, then pick a colour or add a note.

    Reading settings

    For every lesson, saved in this browser.

    Text size
    Line spacing
    Font

    With IaaS you rent the virtual machine. Microsoft looks after the building, power and hardware; you patch the operating system.

    ⚡ The 30-second answer

    Push notifications are best effort: they can be late, merged or dropped. Send them through Azure Notification Hubs (FCM v1 for Android, APNs for iOS) to a tag for the person, update the device installation on every app start, push only state changes with short text and no personal data, and let the app re-read the truth when it opens.

    • One hub for Android and iOS
    • Installations and tags
    • Push only state changes
    • Lock-screen privacy

    Try it

    Play with the design before you read about it. Everything runs on this page.

    No Azure subscription needed. Read the requirement, see the architecture, build it in a mock portal, send a booking through it, then break it.

    ☁ Simulate on Azure: Push notifications that arrive

    Priya's driver has arrived. Her phone is locked, in battery saver, and she reinstalled the app yesterday. She must still find out, and nobody looking at her lock screen should see private details.

    It must

    • Tell riders and drivers about state changes when the app is closed
    • Reach Android (FCM) and iOS (APNs) from one place
    • Target a person, not a device
    • Show the true state when the app opens

    With these numbers

    Delivery
    Best effort, seconds
    Devices
    10M installs
    Pushes per trip
    ≤ 6
    Lock screen
    No personal data

    🎓 Education-only simulation. Nothing is created in Azure and no subscription is needed.

    1. The problemPriya reinstalled the app yesterday. Today her driver arrives and waits 5 minutes outside. She never got the push: it went to her old device token.
    2. The design ideaA push says “look”; the server says what happened.
    3. In real lifeApps that push too often see users turn notifications off within days, and both mobile platforms limit how often a background app can be woken.

    Start with a question

    Priya reinstalled the app yesterday. Today her driver arrives and waits 5 minutes outside. She never got the push: it went to her old device token.

    Pushes travel through Google and Apple, not your servers. Design for the parts you do not control.

    Explain it like I'm 10

    A push is like a note under the door: it says “something changed, come and look”. You still open the door to see what really happened.

    The technical explanation

    One hub. The trip service sends once to Azure Notification Hubs with a tag like user:42. The hub delivers through FCM v1 (the legacy FCM API was retired in 2024) and APNs to all of that person’s devices.

    Fresh registrations. On every app start, create or update the device installation with the current token and the user tag. Tokens change after reinstalls, restores and OS updates.

    Few, safe pushes. Push only state changes (driver matched, arrived, trip ended, receipt): about five per trip. Live location stays on the WebSocket. Lock screens are public, so use short text without names, plates or addresses.

    Trust the server, not the push. When the app opens, it calls GET /trips/{id} and shows that. A late push then does no harm.

    RuleWhy
    Tag by user, not deviceReaches every phone the person uses
    Update installation on startTokens change after reinstalls
    FCM v1 credentialsLegacy FCM API is retired
    Only state changesNo throttling, no muted apps
    Short text, re-sync on openPrivacy and correctness

    ☁ Simulate on Azure🧩 Patterns

    Real-world scenario

    Apps that push too often see users turn notifications off within days, and both mobile platforms limit how often a background app can be woken.

    Ready for more?The full lesson adds the technical explanation, interview questions and quick revision.

    Test yourself

    5 questions. Get 4 right and this lesson is marked complete.

    1. 1. Priya reinstalled the app and stopped getting pushes. What fixes it?
    2. 2. Which Android credentials should a hub use today?
    3. 3. Should live driver location be sent as pushes?
    4. 4. What should a lock-screen notification say?
    5. 5. How do you target all of one person’s devices?

    Pass the quiz to complete this lesson.

    Next: Mock interview: design the taxi app in 45 minutes →

    Questions people ask

    Are push notifications guaranteed to arrive?

    No. Delivery through FCM and APNs is best effort and can be delayed by battery saving or dropped. Design the app to re-read the state when it opens.

    What is the difference between a WebSocket message and a push notification?

    A WebSocket message reaches an app that is open and connected, in under a second. A push reaches a closed or backgrounded app through Google or Apple, with no timing guarantee.

    Can I skip push and just use the WebSocket?

    No. Mobile platforms close sockets soon after an app goes to the background. Push is the only way to reach a closed app, so you need both: the socket for live data, push for “come back and look”.

    Interview questions

    How this topic comes up in system design interviews. Answer out loud first, then open the model answer.

    beginner Why use Azure Notification Hubs instead of calling FCM and APNs yourself?

    One API and tag system for both platforms, it manages device installations and scales to millions of devices.

    intermediate Design notifications for a ride app.

    Trip service emits state changes (from the change feed) → Notification Hubs to tag user:{id} → FCM v1 / APNs; installations updated on every app start; short text; app re-syncs on open; live data on WebSocket only.

    Quick revision

    Remember

    • One hub for Android and iOS
    • Installations and tags
    • Push only state changes
    • Lock-screen privacy
    • Add an in-app status as well as the push. If the push is late, the app still shows the right state the moment it is opened.

    One line to remember

    “A push says “look”; the server says what happened.”

    Official documentation