简体   繁体   English

通过主题将推送通知发送到所有设备

[英]Send push notifications via Topic to all devices

I'm new to push notifications and here's what I understood so far - 我是推送通知的新手,到目前为止,这是我所了解的-

  1. Client app will need to register with Google Cloud Connection Server (GCCS). 客户端应用将需要向Google Cloud Connection Server(GCCS)注册。
  2. GCCS will return a registration ID back to the client. GCCS会将注册ID返回给客户端。
  3. Client will send the device id and registration ID to the app server. 客户端会将设备ID和注册ID发送到应用服务器。
  4. App server will store device & registration in its database. 应用服务器会将设备和注册存储在其数据库中。 This database could get huge depending on the number users. 该数据库可能会变得庞大,具体取决于用户数量。
  5. The app server in my case comprises of a single HTML page, and a node.js script. 在我的情况下,应用程序服务器包含一个HTML页面和一个node.js脚本。 Admin will get to the page, types in a message and hits Send. 管理员将进入该页面,输入消息并点击发送。
  6. The app server will make a POST call to GCCS with the Sender ID, API Token, array of registration ID's etc. 应用服务器将使用发件人ID,API令牌,注册ID的数组等对GCCS进行POST调用。
  7. Message is received by the devices. 设备接收到消息。

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 - 我的问题是-

  1. 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. 似乎多余。
  2. Are there any ready-to-use/commercial GCM servers that can send Topic messages? 是否有任何可以发送主题消息的即用型/商用GCM服务器?
  3. 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问题?

Thanks for the help! 谢谢您的帮助!

  1. 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!",
   }
}
  1. 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为我们提供了一个沙盒项目供我们使用。

  1. 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.

相关问题 使用FCM向所有订阅主题的设备发送推送通知(批量)时出现缩放问题 - Scaling issue while sending push notifications (in bulk) to all the devices subscribed to a topic using FCM 设备离线时接收所有推送通知 - Receive all the push notifications when devices are offline 使用GCM为我的Android应用程序发送推送通知通知给所有设备 - Send Push Notifications notification to all devices using GCM for my android app 使用firebase向所有用户发送推送通知 - Send push notifications using firebase to all the users GCM可以将推送通知发送到的最大设备数量 - Max number of devices can GCM send push notifications to 使用PHP,PDO,MYSQL将Android推送通知发送到多个设备 - Send Android Push Notifications to Multiple Devices using PHP, PDO, MYSQL 从PHP服务器向Android设备发送推送通知 - Send Push Notifications from PHP Server to Android Devices Firebase:在所有设备上向用户发送推送通知 - Firebase: Send push notification to user on all their devices Parse.com推送通知未发送到所有设备 - Parse.com Push notifications not being sent to all devices 在没有 Firebase 控制台的情况下向所有设备发送推送通知 - Sending Push Notifications to all devices without Firebase Console
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM