Firebase Cloud Messaging(FCM)-HTTP V1 API或旧版HTTP API? [英] Firebase Cloud Messaging (FCM) - HTTP V1 API or Legacy HTTP API?

查看:349
本文介绍了Firebase Cloud Messaging(FCM)-HTTP V1 API或旧版HTTP API?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的目标是从后端向设备组发送通知,并且只有从服务器端才能知道哪个设备应该接收通知.

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.

我们已经对AppCenter进行了一些尝试,因为我们主要使用Xamarin iOS/Android/Forms,但是现在我们怀疑直接使用Firebase API可能会更好,因为它更广泛,更强大.

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.

我看到,使用新版本的API(HTTP V1)无法将通知发送到令牌列表,这是使用registration_ids参数(

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.

我当时正在考虑使用设备组消息传递( https://firebase .google.com/docs/cloud-messaging/android/device-group ),但它们是旧版api的一部分,我不确定是否有意义/是否可以在新版本的api中使用它们API.

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.

是否可以发送一批100-200-500推送通知,每个通知仅发送给一个令牌?从理论上讲,可以发送的通知没有限制,但是我担心发送过多的通知可能会被禁止.

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.

使用旧版API更好吗?另外,AppCenter(Microsoft)也使用旧版API,这很明显是因为设置的工作方式,并且因为可以从AppCenter的控制台发送通知到令牌列表,而Firebase的控制台不提供此功能.

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

推荐答案

在我的在此处回答.只是为了重申我的回答,当使用v1将消息发送到多个令牌时,由于不支持registration_ids,现在建议的方法是使用主题消息.

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.

使用旧版API更好吗?

v1被描述为更安全,跨平台,向FCM客户发送消息的面向未来的方式.由于它使用OAuth2安全模型,因此更加安全.

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.

但是,如果您的用例比使用旧版API更好,那么我建议您继续使用它.

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

这篇关于Firebase Cloud Messaging(FCM)-HTTP V1 API或旧版HTTP API?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆