ApnsClient (apns-relay/apns-client.ts)

geospoof · cdk/lib/lambda/apns-relay/apns-client.ts · typescript · Apache-2.0
integration

HTTP/2 client for Apple Push Notification Service that manages sessions, retries, and handles push requests

// Source: https://github.com/GeoSpoof/geospoof | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
 * HTTP/2 client for APNs, ported from geospoof-ios:scripts/apns-push.mjs:
 * `node:http2` `connect("https://" + host)`, one POST to `/3/device/<token>`
 * with exactly the script's headers, then read `:status`, `apns-id` and the
 * `{"reason": ...}` error body.
 *
 * A 200 here is APNs ACCEPTING the push, not delivering it. A start push whose
 * attributes fail to decode is discarded silently after the 200.
 *
 * Session lifecycle (Lambda freezes between invokes, so a socket can be dead
 * without anyone having noticed):
 * - one session cached per authority, dropped on goaway, clo

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key