-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Background push notification docs #745
Comments
TL;DR: A new attribute is required on all APNS API headers. @mattheworiordan @paddybyers Starting from iOS 13 and watchOS 6 (both latest OS versions) Apple requires the presence of the header I wasn’t aware of that change and that’s why the background notifications wasn’t reaching my iPhone when we were testing. Ably Realtime is not setting that HTTP header field. From the documentation:
Source of this information is available in Pushing Background Updates to Your App | Apple Developer Documentation. BTW, there’s an old documentation page which doesn’t explain this change and I had to watch the Apple WWDC 2019 session about Background Pushes Advances in App Background Execution - WWDC 2019 - Videos - Apple Developer. Things that I learned from that video:
More references:
|
@ricardopereira yes, we have an internal issue for this (https://github.com/ably/realtime/issues/2699) You can pass headers to APNS with a payload looking like:
We need to decide when it's appropriate to add these headers automatically. |
Thanks @ricardopereira for this nifo.
Yes, we should decide soon, because at present our docs don't cover this, and expecting our customers to read the APNS docs about background notifications (for default use cases) is not practical. @paddybyers my preference is to continue to provide a high level API for developers to send data notifications with a payload like: {
extras: {
push: {
data: 'this is it, it is portable across platforms'
}
}
} Then if customers want to set |
... Yes I agree with that. However, if the app includes any explicit |
In theory I like this, but it does make it a little harder too. If for exampel, they simply wanted to bump the priority, it wouldn't be unreasonable to just do: {
extras: {
push: {
data: {
key: 'this is it, it is portable across platforms'
},
apns: {
'apns-headers': {
'apns-priority': '10'
}
}
}
}
} Saying that, perhaps a better approach is for us to now look at any other common fields that we think we want to make portable, and just include them as new attributes such as: {
extras: {
push: {
data: {
key: 'this is it, it is portable across platforms'
},
priority: 'normal' | 'high',
}
}
} See https://firebase.google.com/docs/cloud-messaging/concept-options#setting-the-priority-of-a-message for a similar approach by FCM. |
You've chosen an unfortunate example, because in a background notification you have to specify I agree that the set of portable properties can be expanded over time. However, remember that the reason that this is an issue is that iOS 13 has different rules from other versions; so ultimately we have to provide a route for developers to have full control, or we can end up in a situation where the rules change and they cannot construct a valid payload for a given target. The alternative is that we invent some way that someone can suppress the auto-injected content, but that's going to be adding more complexity and more arbitrary rules; I do think the best way to provide full control is to do what I proposed, ie if the app includes any explicit apns headers, then I think they should then control the entire apns section. |
True :)
Ok, but priority is probably a sensible one to add now anyway. I appreciate priority is going to be "normal" for APNS always for data messages, but that's OK. The point is customers should be able to choose this.
Sure, but sadly it is also now our responsibility to keep track of new iOS/Android releases, and make sure our portable versions continue to work, or report the issues to customers so that they are able to address the problem. I think we need to set up a notifications on iOS/Android releases moving forward to a) read the release notes to understand the impact, b) test against beta releases before the go to GA. Do you agree?
Sorry, but I don't, because I think it's unintuitive. Typically, I am convinced developers will intuitively provide I think what would be more acceptable and intuitive, is that if any {
extras: {
push: {
data: {
key: 'this is it, it is portable across platforms'
},
apns: {
'apns-headers': {
'apns-push-type': 'background',
'apns-priority': '5'
}
}
}
}
} I appreciate that still means developers are still subject to some brittleness and additional work, but replacing the entire |
Our documentation does not make it clear how background notifications (data) work with iOS and Android.
We have hit some issues recently for customers, which highlights issues in our docos.
@ricardopereira @paddybyers can you post in your findings into this issues so that we can improve our docs. Related issue https://github.com/ably/realtime/issues/2699
┆Issue is synchronized with this Jira Task by Unito
The text was updated successfully, but these errors were encountered: