Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is firebase not always sending notifications through APNs?

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.

like image 463
SudoPlz Avatar asked Dec 04 '18 19:12

SudoPlz


People also ask

Does FCM uses APNs?

FCM delivers all messages targeting Apple apps through APNs. To learn more about receiving APNs notifications via UNUserNotificationCenter, see Apple's documentation on Handling Notifications and Notification-Related Actions.

Is there a limit for Firebase notifications?

Maximum message rate to a single device For Android, you can send up to 240 messages/minute and 5,000 messages/hour to a single device.


1 Answers

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.

like image 170
Ian Barber Avatar answered Nov 06 '22 03:11

Ian Barber