Skip to content

Push notifications

Without APNs credentials the server runs items and the apps show their results, but nothing reaches your devices as a notification. To turn push on:

  1. In your Apple developer account, under Certificates, Identifiers & Profiles › Keys, create a key with Apple Push Notifications service (APNs) enabled. Download AuthKey_<KEY ID>.p8 (you can only download it once) and note the key ID and your team ID.

  2. Put the file in server/apns/ (mounted read-only into the container; git ignores it) and set in .env:

    Terminal window
    RUNDOWN_APNS_KEY_FILE=/apns/AuthKey_ABC123DEFG.p8
    RUNDOWN_APNS_KEY_ID=ABC123DEFG
    RUNDOWN_APNS_TEAM_ID=TEAM123456
  3. docker compose up -d. The log says "push":{"topic":"de.alhaidari.rundown",…}, and the app’s Server screen shows push as On.

If you build the app with your own bundle ID, set RUNDOWN_APNS_TOPIC to it.

The same key works for development builds (Xcode, the APNs sandbox) and TestFlight or App Store builds (production); each device tells the server which one it uses. Tokens APNs reports as no longer valid are removed.

Every paired device that registered for push gets every notification. The payload carries:

  • the item’s ID, so a tap opens the item;
  • its link, for Open Link;
  • the thread (one per item), so notifications group per item;
  • the category, so Mute for 1 Day works — and acts on the server;
  • the interruption level;
  • the notifications delivered in the last 24 hours, as many as fit.

APNs keeps only the newest push for a device it can’t reach, so after a night in airplane mode only the last notification would arrive. That’s why each push lists the ones before it: the iPhone’s notification service extension remembers which ones it has seen and posts the others quietly, next to the push that brought them. Notifications older than a day aren’t recovered (APNs drops the push itself after a day), but they’re still in Notification History.

When server items’ cards change, the server also sends a silent push that lets the apps refresh those cards in the background — at most one per 20 minutes, listing every changed item. That keeps widgets and the watch reasonably current for server items. Turn it off with RUNDOWN_APNS_BACKGROUND_UPDATES=off.

server/test/fixtures/apns/ has one payload of each kind, and

Terminal window
scripts/simulator-push alert <item id>

delivers one to the booted Simulator the way the server would send it. missed lists two earlier notifications; send alert first, since the first push only records what came before it.