更简单的推送通知,或许问服务器是否有任何问题? [英] Simpler push-notification, perhaps ask server if there is any?

查看:104
本文介绍了更简单的推送通知,或许问服务器是否有任何问题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个IDE上工作,我作为管理员可以将通知发送给所有客户端(移动设备)。我一直在寻找和发现GCM和其他服务......我想知道是否有更简单的解决方案。



我想每隔1小时从所有客户端(移动设备)向我的服务器发出一个休息电话以检查新通知。如果有,请获取它们,然后在客户端(移动设备)上显示这些通知。 解决方案

Polling 将导致更多的电池寿命消耗和一些其他额外的不必要的过程(也在@MohammedAtif的评论中提到),例如,当你的客户端应用程序打电话给你的服务器,但最终是空的。这个过程是浪费的,因为没有真正发生。



GCM不这样做。请参阅有关流量的官方文档


生命周期流程


  • 发送和接收下游消息。


    • 发送消息。应用程序服务器将消息发送到客户端应用程序:


      1. 应用程序服务器向GCM连接服务器发送消息。

      2. 如果设备处于脱机状态,则GCM连接服务器将排队并存储消息。

      3. 设备联机时,GCM连接服务器将消息发送至设备。 b
      4. 在设备上,客户端应用程序根据平台特定的实现接收消息。详细信息请参阅平台特定的文档。


    • 接收消息。客户端应用程序收到来自GCM连接服务器的消息。



最近在2016年I / O大会上宣布,GCM的继任者现在 Firebase云消息传递,它不仅具有推送通知服务,还具有免费的其他功能(例如Analytics)。

因此,总体而言,使用GCM(或FCM)比轮询更简单。它处理您发送的消息和其他一些消息的队列。


Im working on a ide where I as an admin can send notifications to all my clients(mobile). Ive been searching and found GCM and other services... I want to know if there is any simpler solutions.

I thought about making a rest call from all clients(mobile) to my server every 1 hour to check for new notifications. And if there is, get them and then present those notifications i the clients(mobile).

解决方案

Polling will result to more battery life consumption and some other extra unnecessary process (as also mentioned in the comments by @MohammedAtif), for example, is when your client app makes the call to your server but ends up empty. The process is wasted since nothing really happened.

GCM doesn't do that. Gonna refer to the official docs on it's flow.

Lifecycle Flow

  • Send and receive downstream messages.
    • Send a message. The app server sends messages to the client app:

      1. The app server sends a message to GCM connection servers.
      2. The GCM connection server enqueues and stores the message if the device is offline.
      3. When the device is online, the GCM connection server sends the message to the device.
      4. On the device, the client app receives the message according to the platform-specific implementation. See your platform-specific documentation for details.

    • Receive a message. A client app receives a message from a GCM connection server.

Also announced in the recent I/O 2016, GCM's successor is now Firebase Cloud Messaging, which not only has the Push Notification Service, but also has other features (one example is Analytics) for free.

So overall, using GCM (or FCM) is a simpler method than polling. It handles the queuing of the messages you sent, and some others.

这篇关于更简单的推送通知,或许问服务器是否有任何问题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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