Reputation: 23243
I noticed that the firebase documentation says the following:
If a notification payload is provided, or the content_available option is set to true for a message to an iOS device, the message is sent through APNs, otherwise it is sent through the FCM connection server.
Can someone please explain what that means?
I thought ALL push notifications sent to iOS devices, are first sent to Apple, and then forwarded by Apple to the corresponding device/s, but here it is implied that they're sending messages directly to the device?
Is that even possible when the app is shut on iOS?
I'm confused, thank you.
Upvotes: 5
Views: 1699
Reputation: 19960
When the app is in the foreground, FCM can connect directly rather than go via APNs for data
type messages. Messages sent when in the background are delivered via APNs as you'd expect. You can actually take a look at the source of the FCM client if you're so inclined!
You can control whether this is used with the shouldEstablishDirectChannel property.
From the sending perspective, you don't need to worry too much about this - its handled transparently as part of the FCM service based on the type of the message and whether there is a client connected.
Upvotes: 3
Reputation: 34780
From my understanding after reading the document, it might be trying to state that:
If the notification can be inferred to be targeted to an iOS device (whether from notification payload or the content-available key), it bypasses FCM and gets sent to APNS directly for optimization as it's known for 100% to be destined to APNS anyway.
Otherwise, it will be sent to FCM and be routed to wherever it should go from there. It might still be a notification for an iOS device and be sent to APNS from FCM, but it just can't be inferred.
Upvotes: 2