gpt4 book ai didi

ios - Firebase 云消息传递 - 向所有用户发送消息

转载 作者:行者123 更新时间:2023-12-01 00:40:28 25 4
gpt4 key购买 nike

我是使用 Firebase 云消息的新手。我构建了一个 IOS 应用程序来接收推送通知。该应用程序运行良好。我从 Firebase 控制台发送消息并且它们显示正确。

现在我正在尝试构建一个 web api 以允许我的客户发送推送消息(无需访问 firebase 控制台)。研究文档 here我意识到我总是有一个“to”,意思是一个组、主题或设备 ID。

我的问题是:我可以向所有设备发送消息吗(就像我可以在控制台中做的那样)?我是的,怎么会这样?

提前致谢!

最佳答案

您可以使用主题。鉴于您的所有用户都订阅了特定的用户。就像我说的here (删除了一些部分,如果需要,请查看它们):

If you are looking for a payload parameter to specify that you intend the message for all your users, unfortunately, it doesn't exist.

Commonly, when sending notifications to multiple users, you can make use of the registration_ids parameter instead of to. However, it only has a maximum of 1000 registration tokens allowed. If you intend to use this, you can make batch requests of 1000 registration tokens each, iterating over all the registration tokens you've stored in your app server.

However, do keep in mind that Diagnostics for messages sent to Topics are not supported.

关于ios - Firebase 云消息传递 - 向所有用户发送消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39772167/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com