/** * iOS 18 broadcast channels for Live Activities. * * Channels let many devices subscribe to a single broadcast push — ideal for * "everyone watching this game" style updates. There are two endpoints: * * - **Channel management** (`api-manage-broadcast(.sandbox).push.apple.com`, * ports `2196`/`2195`): create / read / delete / list channels. Creating a * channel returns a base64 `apns-channel-id`. * - **Broadcast send** (the regular push host `api.push.apple.com:443`): * `POST /4/broadcasts/apps/` with an `apns-channel-id` header and * **no** `apns-topic`. Carries the same `update`/`end` envelope (you cannot * `start` an activity via broadcast). * * @packageDocumentation */ import { type ApnsPayload } from './payload.js'; import { type ApnsPriority, type ApnsResult, type EndOptions, type LiveActivityPusherConfig, type UpdateOptions } from './types.js'; /** Result of {@link BroadcastChannelManager.createChannel}. */ export interface CreateChannelResult { /** Base64 channel id assigned by APNs (the `apns-channel-id` header). */ channelId: string; /** Raw parsed APNs result (status, apns-id, etc.). */ raw: ApnsResult; } /** Result of {@link BroadcastChannelManager.listChannels}. */ export interface ListChannelsResult { /** Base64 channel ids returned by APNs. */ channels: string[]; /** Raw parsed APNs result. */ raw: ApnsResult; } /** * Manage broadcast channels and send broadcast pushes (iOS 18+). * * Create one per app/environment and share it; it keeps two reused HTTP/2 * sessions warm (management + send). Call {@link BroadcastChannelManager.close} * on shutdown. */ export interface BroadcastChannelManager { /** * Create a new broadcast channel. Returns the base64 `apns-channel-id` to * store and hand to clients (as `input-push-channel`) and to * {@link broadcast}. Up to 10,000 channels per app/environment. */ createChannel(options?: { /** `message-storage-policy` (`0` no storage, `1` store; default `1`). */ messageStoragePolicy?: 0 | 1; }): Promise; /** Read a channel's metadata; resolves to the parsed APNs result. */ readChannel(channelId: string): Promise; /** Delete a channel. Resolves to the parsed APNs result (`204` on success). */ deleteChannel(channelId: string): Promise; /** List all channel ids for the app. */ listChannels(): Promise; /** Broadcast a content-state `update` to all subscribers of a channel. */ broadcastUpdate(channelId: string, options: UpdateOptions): Promise; /** Broadcast an `end` to all subscribers of a channel. */ broadcastEnd(channelId: string, options?: EndOptions): Promise; /** * Broadcast a pre-built `update`/`end` payload to a channel. Escape hatch; * enforces the 4 KB limit and standard headers. */ broadcast(channelId: string, payload: ApnsPayload, options?: { priority?: ApnsPriority; expiration?: number; apnsId?: string; }): Promise; /** Gracefully close both underlying HTTP/2 sessions. Idempotent. */ close(): Promise; } /** * Construct a {@link BroadcastChannelManager}. * * @throws {ApnsError} `'invalid-argument'` when required credentials are missing. */ export declare function createBroadcastChannelManager(config: LiveActivityPusherConfig): BroadcastChannelManager; //# sourceMappingURL=broadcast.d.ts.map