← Lessons

quiz vs the machine

Gold1450

System Design

Push Notification Token Management

Storing rotating and pruning device tokens so push messages reach the right devices.

5 min read · core · beat Gold to climb

What a token is

A device token is an identifier issued by the platform that lets you push to one app install on one device. A user with three devices has three tokens.

Lifecycle

  • The app registers a token at login and on launch.
  • Tokens rotate when the OS reissues them, so the service must update mappings.
  • Tokens expire when an app is uninstalled or unused for long.

Storage model

A store maps user to many tokens, each tagged with platform, app version, and last seen. Sending to a user fans out to all live tokens.

Pruning

Push gateways return feedback that a token is invalid. The service must remove those tokens promptly, or it wastes calls and hurts deliverability metrics.

Key idea

Token management maps users to many device tokens, updates rotations, and prunes dead tokens using gateway feedback.

Check yourself

Answer to earn rating on the learn ladder.

1. Why must the service prune dead tokens?

2. How is the token store usually modeled?

3. When do tokens commonly rotate?