swift-server-community / APNSwift

📱HTTP/2 Apple Push Notification Service built with swift - send push notifications to iOS, iPadOS, tvOS, macOS, watchOS, visionOS, and Safari!
Apache License 2.0
693 stars 105 forks source link

iOS 16.1 Live Activity support added #162

Closed nasircsms closed 2 years ago

alex-de-waal commented 2 years ago

Thank you for this, you are a legend!

How would I use the Activity's push token in the request's header? As described in the documentation:

To use remote push notifications to update your Live Activities, you need to use push tokens for authenticating with APNs as described in Establishing a Token-Based Connection to APNs.

When you’ve successfully started your Live Activity, you receive an Activity with a pushToken. Send it to your push notification server, and use it to send remote push notifications that update or end the Live Activity.

Send push notifications to the Live Activity using the push token you stored on your server. It’s essential that you set the fields for the content-state key to match your custom Activity.ContentState type to ensure the system can decode the JSON payload and update the Live Activity.

nasircsms commented 2 years ago

The deviceToken param will contain Activity pushToken. There is no need to send it separately. So we'll be sending push notification using Activity pushToken and deviceToken won't be required in this case. I should have updated param name to reflect this.

alex-de-waal commented 2 years ago

Awesome, that helps a lot! Thanks again dude

kylebrowning commented 2 years ago

@nasircsms planning on making these changes or should I take over?

kylebrowning commented 2 years ago

closing in favor of #164