Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Data messages not delivered to iOS when using new HTTP v1 API

Firebase supports Notification messages and Data messages.

Data messages don't trigger visual notification and are handled by the client (iOS App) when the app is in foreground. Communication is then done using direct channel between Firebase and iOS App - without use of Apple Push Notification Service (APNS).

Everything works fine when we use Legacy FCM HTTP Protocol but when using new HTTP v1 API, Data messages are not delivered to iOS client.

Notification messages (even including data) are delivered fine using via APNS.

We have tried interfacing to Firebase Cloud Messaging using:

  • Admin FCM API (Java and Node.JS SDKs)
  • Direct HTTP request to HTTP v1 API using OAuth2 tokens

None of the above would result in Data message to be delivered to the iOS client. Such messages are only delivered when being sent using legacy HTTP Protocol.

To make things more interesting Data messages send using HTTP v1 API (new) are successfully delivered to web JavaScript client, so it means that they are supported. They are also used in samples. We haven't tried the Android client.

like image 926
Michał Maciej Gałuszka Avatar asked Aug 23 '18 14:08

Michał Maciej Gałuszka


People also ask

Does Firebase notification work on iOS?

For Apple client apps, you can receive notification and data payloads up to 4000 bytes over the Firebase Cloud Messaging APNs interface.

Does Safari support Firebase messaging?

Safari still does not support Web Push API, thus Firebase Cloud Messaging service.


1 Answers

From the Firebase Cloud Messaging docs on handling direct FCM channel messages:

Caution: To use the FCM direct channel this way, you must send messages using the legacy HTTP API. The HTTP v1 API uses APNs for all messages sent to iOS devices. See FCM server protocols.

like image 103
jbg Avatar answered Oct 19 '22 20:10

jbg