Skip to content

Commit fe9ec89

Browse files
committed
docs: add info about broadcast
1 parent b810db3 commit fe9ec89

3 files changed

Lines changed: 78 additions & 1 deletion

File tree

website/docs/ios/api/configuration.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,21 @@ await startLiveActivity(variants, {
9494

9595
**Valid range:** 0.0 to 1.0 (default: 0.0)
9696

97+
### Channel ID (broadcast push, iOS 18+)
98+
99+
The `channelId` option subscribes the Live Activity to a broadcast channel for server-side updates. When provided, the activity receives updates via broadcast push notifications instead of individual device tokens—one server notification updates all activities on that channel. Requires `enablePushNotifications: true` and the Broadcast Capability enabled in your Apple Developer account.
100+
101+
```typescript
102+
import { startLiveActivity } from 'voltra/client'
103+
104+
await startLiveActivity(variants, {
105+
activityName: 'match-123',
106+
channelId: 'CTrNsYq/Ee8AALLzHQaVlA==', // From APNs channel management
107+
})
108+
```
109+
110+
For full broadcast setup, see [Server-side updates - Broadcast push notifications](../development/server-side-updates.md#broadcast-push-notifications-ios-18).
111+
97112
These options can be used together with dismissal policy and other configuration options:
98113

99114
```typescript

website/docs/ios/development/managing-live-activities-locally.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@ const variants = {
5050
}
5151

5252
const activityId = await startLiveActivity(variants, {
53-
activityId: 'order-123', // Optional: for re-binding on app restart
53+
activityName: 'order-123', // Optional: for re-binding on app restart
5454
deepLinkUrl: 'myapp://order/123', // Optional: URL to open when tapped
55+
channelId: 'CTrNsYq/Ee8AALLzHQaVlA==', // Optional: broadcast channel (iOS 18+)
5556
dismissalPolicy: { after: 30 },
5657
staleDate: Date.now() + 60 * 60 * 1000, // 1 hour
5758
relevanceScore: 0.8,
@@ -257,6 +258,20 @@ await startLiveActivity(variants, {
257258

258259
Live Activities can receive updates even when your app is in the background or terminated, but they cannot execute JavaScript code. For real-time updates from backgrounded apps, use server-side push notifications.
259260

261+
### Channel ID (broadcast push, iOS 18+)
262+
263+
Subscribes the Live Activity to a broadcast channel for server-side updates. When provided, the activity receives updates via broadcast push notifications instead of individual device tokens—one server notification updates all activities on that channel.
264+
265+
```typescript
266+
// For shared content (e.g., live sports, flight status)
267+
await startLiveActivity(variants, {
268+
activityName: 'match-123',
269+
channelId: 'CTrNsYq/Ee8AALLzHQaVlA==', // From APNs channel management
270+
})
271+
```
272+
273+
Requires `enablePushNotifications: true` in the Voltra plugin and the Broadcast Capability enabled in your Apple Developer account. See [Server-side updates](./server-side-updates.md#broadcast-push-notifications-ios-18) for details.
274+
260275
## Best practices
261276

262277
### Activity lifecycle management

website/docs/ios/development/server-side-updates.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,53 @@ useEffect(() => {
210210

211211
Use only Voltra-provided tokens, which are specialized for Live Activity push notifications and different from regular device tokens. Update tokens are tied to specific Live Activities, while push-to-start tokens are for starting new activities. Update tokens are provided when Live Activities are started and may change during the activity's lifecycle. When sending notifications via APNS, use these push tokens as the target device token to route notifications to the correct Live Activity or device.
212212

213+
## Broadcast push notifications (iOS 18+)
214+
215+
Starting with iOS 18 and iPadOS 18, you can use **broadcast push notifications** to update many Live Activities with a single push notification. Instead of sending individual notifications to each device token, you send one broadcast to a shared channel—all Live Activities subscribed to that channel receive the update. This is ideal for scenarios like live sports scores or flight status where many users follow the same event.
216+
217+
### Prerequisites
218+
219+
1. **Enable Broadcast Capability:** In your [Apple Developer account](https://developer.apple.com/account), go to Certificates, Identifiers & Profiles > Identifiers, select your App ID, and enable **Broadcast Capability** under Push Notifications.
220+
221+
2. **Create a channel:** Your server creates a channel via APNs and receives a channel ID. You can maintain up to 10,000 channels per app. Use [Apple Push Notification Console](https://icloud.developer.apple.com/dashboard/notifications/) or the [channel management API](https://developer.apple.com/documentation/usernotifications/sending-channel-management-requests-to-apns) to create channels.
222+
223+
3. **Plugin configuration:** Keep `enablePushNotifications: true` in your Voltra plugin config—the `aps-environment` entitlement is still required for broadcast push.
224+
225+
### Starting a Live Activity with a channel
226+
227+
Pass the `channelId` option when starting a Live Activity to subscribe it to a broadcast channel:
228+
229+
```typescript
230+
import { startLiveActivity } from 'voltra/client'
231+
import { Voltra } from 'voltra'
232+
233+
const activityId = await startLiveActivity(variants, {
234+
activityName: 'match-123',
235+
channelId: 'CTrNsYq/Ee8AALLzHQaVlA==', // Channel ID from your server
236+
})
237+
```
238+
239+
When `channelId` is provided, the Live Activity subscribes to broadcast updates. On iOS versions before 18, `channelId` is ignored and the activity starts without push support.
240+
241+
### Sending broadcast updates
242+
243+
To update all Live Activities on a channel, send a POST request to APNs with:
244+
245+
- **Path:** `/4/broadcasts/apps/<your.bundle.id>` (bundle ID without the `.push-type.liveactivity` suffix)
246+
- **Header:** `apns-channel-id: <Channel ID>`
247+
- **Payload:** Same structure as individual updates—`event: "update"`, `content-state`, `timestamp`, etc.
248+
249+
For the full broadcast payload format and headers, see [Apple's broadcast push documentation](https://developer.apple.com/documentation/usernotifications/sending-broadcast-push-notification-requests-to-apns).
250+
251+
### Broadcast vs. individual tokens
252+
253+
| Aspect | Individual tokens | Broadcast |
254+
|--------|-------------------|-----------|
255+
| Server sends | One notification per device | One notification per channel |
256+
| `activityTokenReceived` event | Fires for each activity | Does not fire |
257+
| Best for | Per-user content (orders, rides) | Shared content (scores, flights) |
258+
| iOS version | 16.2+ | 18+ |
259+
213260
## Handling background execution
214261

215262
When Live Activity tokens change or need to be refreshed, iOS may wake your app in the background to deliver new tokens. The app has a limited window of time (typically around 30 seconds) to handle the event and communicate with your server before iOS may suspend or terminate the background process.

0 commit comments

Comments
 (0)