Firebase Cloud Messaging (FCM) - HTTP V1 API or Legacy HTTP API?

Mauro Piccotti picture Mauro Piccotti · Mar 9, 2018 · Viewed 9k times · Source

Our goal is sending notifications to groups of devices from our backend, and only from server side is possible to know which device should receive the notification.

We've done some attempts with AppCenter because we mostly work with Xamarin iOS/Android/Forms, but now we have the doubt that it's probably better to use directly Firebase API because wider and more powerful.

I see that with new version of API (HTTP V1) is not possible to send a notification to a list of tokens, feature that was available in legacy API using registration_ids parameter (https://firebase.google.com/docs/cloud-messaging/send-message).

Device group name (legacy protocols only)

I cannot use topics because when it's time to send the communication is a server's responsibility to prepare the "mailing list" for notifications.

I was thinking to use device group messaging (https://firebase.google.com/docs/cloud-messaging/android/device-group) but these are part of the legacy api, and I'm not sure if it makes sense/it's possible to use them with new version of API.

Is an option to send a batch of 100-200-500 push notifications each one to only one token? In theory there isn't a limit to notifications which is possible to send, but I'm worried that sending too many of them I could risk to be banned.

Is it better to use legacy API? Also AppCenter (Microsoft) uses legacy API, it's evident because of how the setup works and because from AppCenter's console it's possible to send notifications to a list of tokens, feature unavailable on Firebase's console.

Another person just asked something similar but the answer was to use topics (How to send firebase notification for all user at a time?).

Answer

AL. picture AL. · Mar 10, 2018

Got here from the link in your comment in my answer here. And just to reiterate my response there, when sending messages to multiple tokens with v1, the suggested approach now is to use Topics Messaging, since registration_ids is not supported.

Is it better to use legacy API?

v1 was described as the more secure, cross platform, future proof way of sending messages to FCM clients. More secure since it uses OAuth2 security model.

However, if your use-case is better with using the legacy API, then I suggest you go ahead with using it.