[英]Send push notifications via Topic to all devices
I'm new to push notifications and here's what I understood so far - 我是推送通知的新手,到目前为止,这是我所了解的-
There is also this thing called as Topics that the client apps can subscribe to. 客户端应用程序也可以订阅称为主题的东西。 Using Topics, you do not have to send registration ID's of all devices.
使用主题,您不必发送所有设备的注册ID。 All devices "subscribed" to this Topic will get the message.
“订阅”该主题的所有设备都将收到此消息。 This is very useful if you have millions of users (depending on the popularity of the app) and you don't have to split the registration ID's into chunks of 1000s to send the message.
如果您有数百万的用户(取决于应用程序的受欢迎程度),并且不必将注册ID分成1000个大块来发送消息,则此功能非常有用。
My questions are - 我的问题是-
Thanks for the help! 谢谢您的帮助!
- If we're using Topics, do we need to persist the Registration ID, Device ID to a database on the App server?
如果我们使用主题,是否需要将注册ID,设备ID持久保存到App服务器上的数据库中? It seems redundant.
似乎多余。
Are you referring to C2DM implementations? 您是指C2DM实现吗? Those are deprecated as shown on the GCM documentation .
那些已弃用,如GCM文档中所示 。 In relation to topics, they may not be necessary but are necessary to other message calls.
关于主题,它们可能不是必需的,但对于其他消息调用则是必需的。
Based on the documentation, to
needs to be set as topic/[yourTopic]
with the necessary payload 基于文档,
to
需要被设置为topic/[yourTopic]
必要的有效载荷
https://gcm-http.googleapis.com/gcm/send
Content-Type:application/json
Authorization:key=AIzaSyZ-1u...0GBYzPu7Udno5aA
{
"to": "/topics/foo-bar",
"data": {
"message": "This is a GCM Topic Message!",
}
}
- Are there any ready-to-use/commercial GCM servers that can send Topic messages?
是否有任何可以发送主题消息的即用型/商用GCM服务器?
I can't find any sources about this, so I'm guessing we're left to implement it on our own application server. 我找不到有关此资源的任何资料,所以我猜想我们只能在自己的应用程序服务器上实现它。 Google provided us with a sandbox project for us to play with.
Google为我们提供了一个沙盒项目供我们使用。
- Is it easy enough to build on your own (since its a simple POST call)?
是否很容易自己构建(因为它是一个简单的POST调用)? If I'm going to use JavaScript, wouldn't I run into CORS issue?
如果我要使用JavaScript,是否会遇到CORS问题?
If you're talking about setting up the Client App (specifically Android), there's a setup guide on the documentation . 如果您在谈论设置客户端应用程序(特别是Android),则文档中有设置指南 。 But if its more on the application server, I can't comment on it really.
但是,如果它更多地在应用服务器上,我将无法对此发表评论。 XMPP libraries can be used to handle XMPP Connection Servers
XMPP库可用于处理XMPP连接服务器
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.