Skip to main content

Module push

Module push 

Source
Expand description

Apple’s push service, for reaching a koan iOS app that iOS has suspended.

A linked app is reached over its WebSocket. iOS suspends an app in the background that is not playing, and the socket dies with it; a push is the supported way back. Two kinds: a background push that wakes the app for half a minute to link and take what waits for it in the outbox, and a notification for playback, which iOS will not let a suspended app start on its own: the person taps it, the app opens and plays.

Token auth: a JWT signed with the team’s .p8 key, reused for under an hour as Apple asks. HTTP/2, which is all the gateway speaks.

A notification carries a link to its album’s cover, which the app’s notification service extension fetches and attaches. The extension holds no credentials, so the link authorises itself: an HMAC over one track id and an expiry, keyed by a secret that lives only in this process. It opens that one cover for a few minutes and nothing else.

Structs§

ActivityState
What a Live Activity shows of the device it follows. The field names are the app’s RemoteActivity.ContentState, which decodes it.
Pusher

Enums§

Outcome
What became of a push.
Push
What a push asks of the device.

Functions§

payload
The JSON a push carries. The command rides under koan, beside Apple’s aps, so the app can act on it without asking the server first.
pusher
The server’s pusher, from the config it started with; None when no key is configured, and pushes are simply not sent.
router
/push/cover/{track}/{expires}/{sig}: public, since the extension that fetches it has no login. Anything but a valid, unexpired link is a 404.