如何将推送通知发送到Web浏览器? [英] How to send push notification to web browser?

查看:271
本文介绍了如何将推送通知发送到Web浏览器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

过去几个小时,我一直在阅读有关推送通知API 网络通知API 。我也发现Google& Apple分别通过GCM和APNS免费提供推送通知服务。

我想了解我们是否可以使用桌面通知实现推送通知给浏览器,我相信这是Web Notification API所做的。我看到一个谷歌文档,介绍如何为Chrome浏览器此处此处



现在还不能理解的是:


  1. 我们可以使用GCM / APNS发送推送通知给所有的Web浏览器,包括Firefox& Safari?

  2. 如果不是通过GCM,我们可以用我们自己的后端做同样的事情吗?



  3. 我相信所有这些答案在一个答案中可以帮助很多有类似困惑的人。

    解决方案

    所以我在这里回答我自己的问题。我已经得到了过去构建推送通知服务的人的所有查询的答案。



    快速回答我提出的两个问题。



    1. 我们可以使用GCM / APNS向所有Web浏览器
      发送推送通知,包括Firefox& Safari?


    答案:仅限Chrome和Android手机。
    GCM的新版本是FCM(Firebase Cloud Messaging),并增加了对所有平台的支持。 FCM支持网络推送协议所有浏览器都已实现。 (常见问题



    1. 如果不通过GCM,我们可以让自己的后端也这样做吗?


    答案:是的,推送通知可以从我们自己的后端发送。支持相同的即将到来已经发布到所有主流浏览器。

    以各种编程语言实现自己的后端:



    进一步阅读


    • Google推出的一个非常好的Web推送概述在这里找到。

    • 一个常见问题回答最常见的c


      有没有免费的服务可以做同样的事情?

    • 一些公司提供免费,免费增值和付费模式的类似解决方案。上面列出了以下几项:


      1. https:/ /onesignal.com/ (全免费|支持手机+浏览器)

      2. https ://clevertap.com/ (有免费计划)

      3. https:/ /goroost.com/

      4. https: //firebase.google.com/products/cloud-messaging/ (免费)

      除此之外,您需要让HTTPS发送推送通知。希望这可以帮助其他人。


      I have been reading for past few hours about Push Notification API and Web Notification API. I also discovered that Google & Apple gives push notification service for free via GCM and APNS respectively.

      I am trying to understand if we can implement push notification to browsers using Desktop Notification, which I believe is what Web Notification API does. I saw a google documentation on how this can be done for Chrome here & here.

      Now what am still not able to understand is:

      1. Can we use GCM/APNS to send push notification to all Web Browsers including Firefox & Safari?
      2. If not via GCM can we have our own back-end to do the same?

      I believe all these answered in one answer can help a lot of people who are having similar confusions.

      解决方案

      So here I am answering my own question. I have got answers to all my queries from people who have build push notification services in the past.

      To quickly answer the two questions I asked.

      1. Can we use GCM/APNS to send push notification to all Web Browsers including Firefox & Safari?

      Answer: GCM as of now can be used with Chrome and Android phones only. GCM's new version is FCM(Firebase Cloud Messaging) and has added support for all platforms. FCM supports the web push protocol that all browser has implemented. (FAQ here)

      1. If not via GCM can we have our own back-end to do the same?

      Answer: Yes, push notification can be sent from our own back-end. Support for the same is coming has come to all major browsers.

      Implementing own backend in various programming languages.:

      Further Readings:

      Are there any free services to do the same? There are some companies that provide a similar solution in free, freemium and paid models. Am listing few below:

      1. https://onesignal.com/ (Fully Free | Support mobile + browser)
      2. https://clevertap.com/ (Has free plan)
      3. https://goroost.com/
      4. https://firebase.google.com/products/cloud-messaging/ (Free)

      Apart from that, you need to have HTTPS to send push notification. Hope this helps others too.

      这篇关于如何将推送通知发送到Web浏览器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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