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

10,591

Solution 1

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.

Solution 2

This page suggests that you should stay with the legacy API if you want to continue to use the multicast feature: https://firebase.google.com/docs/cloud-messaging/migrate-v1

Any apps that use device group messaging or multicast messaging, however, may prefer to wait for future versions of the API. HTTP v1 does not support these features of the legacy API.

Share:
10,591

Related videos on Youtube

Mauro Piccotti
Author by

Mauro Piccotti

I earn money and spend the most of my time as full-stack developer focused on mobile, even though I like more writing on back-end, and about front-end my favourite activity is thinking about UX. Whenever possible I like to travel somewhere: plane, train, car, motorcycle or on foot doesn't make any difference. I'm a Couchsurfing addicted. In my spare time once in a while I like to work in my family's little vineyards.

Updated on July 23, 2022

Comments

  • Mauro Piccotti
    Mauro Piccotti almost 2 years

    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?).

  • Mauro Piccotti
    Mauro Piccotti over 6 years
    Thank you. At the moment our first option would be to use the new Api but sending batch some hundreds of single requests, hoping that it works (one/two devices for a few dozens to a few hundreds of users). Do you have any experience with this approach?
  • AL.
    AL. over 6 years
    If you're wondering if there's a limit to the request, AFAIK, there isn't.
  • Mauro Piccotti
    Mauro Piccotti over 6 years
    Always old answers referring to legacy API, I hope that everything will work fine when we'll send hundreds of post requests in parallel (sorry for the waste of traffic). Will do an attempt, in case of problems we'll switch back to old api, maybe we are lucky and meanwhile Google will add this missing feature which was available in legacy API. Thank you.
  • AL.
    AL. over 6 years
    The only difference between v1 and legacy was mentioned in the blogpost I linked. For the limits, IMHO, they should stay the same. Cheers!
  • Lassi Kinnunen
    Lassi Kinnunen over 5 years
    The new http v1 api ios data messages support(and the aps support in it general) seems broken. it can send notifications but that seems to be it. they don't kind of tell that it doesn't work but don't provide a working example either and some that should work will return 400.
  • AWhitford
    AWhitford about 4 years
    Multicast Messaging is now supported.