自定义推送服务 [英] Custom Push Service

查看:68
本文介绍了自定义推送服务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在将通知推送到网络浏览器的上下文中,PUSH SERVICE 充当 SERVICE WORKER 和 APPLICATION SERVER 之间的接口.

In the context of pushing notifications to web-browsers, the PUSH SERVICE acts as interface between the SERVICE WORKER and APPLICATION SERVER.

我目前的理解是

  • Google FCM 是 Google Chrome & 的推送服务火狐浏览器
  • APNS(Apple 推送通知服务)是 Safari 浏览器的推送服务

这里,在技术上是否可以用一个通用的自定义服务工作线程来替代推送服务"(即 Google Chrome & FireFox 浏览器的 Google FCM 和 Safari 的 APNS),这可能会解决所有流行的问题支持 Service Worker 和 Push API 的浏览器?

Here, is it technically possible to substitute the ‘push service(s)’ (– i.e., Google FCM for Google Chrome & FireFox browsers and APNS for Safari) with a generic custom service worker which could potentially address all the popular browsers that support Service Worker and Push API?

换句话说,开发者是否可以控制浏览器使用哪个推送服务(或)为所有浏览器开发自定义推送服务?

In other words, whether developers have control over which push service to be used for a browser (or) develop a custom push service for all the browsers?

推荐答案

你基本正确:推送服务充当服务工作者和应用程序服务器之间的接口,此外服务工作者(或可能是 Webapp) 将订阅信息发送到推送服务之外的应用服务器,因此应用服务器知道端点以及如何正确加密任何通知内容.

You're mostly correct: the Push Service acts as an interface between a service worker and application server, with the addition that the service worker (or potentially the web app) sends subscription info to the application server outside the Push Service, so the application server knows the endpoint and how to properly encrypt any notification content.

Google 在 Chrome 上使用 GCM/FCM,而 Mozilla 在桌面版 Firefox 中使用自己的 Push Service,而在 Android 上使用 GCM/FCM 和/或自己的服务;请参阅Firefox 使用哪些信息来提供 Web 推送?"此处.

Google uses GCM/FCM for Chrome, and Mozilla uses its own Push Service in Firefox for desktop, while using GCM/FCM and/or its own service for Android; see the "What information does Firefox use to provide Web Push?" section here.

在撰写本文时,ChromeFirefoxEdge 支持 Push API,因此无需单独处理每个 (WebKit 不支持).

At the time of writing this, Chrome, Firefox and Edge support the Push API, so there's no need to handle each seperately (WebKit doesn't support it).

简短回答:开发人员无法选择客户端使用哪种推送服务,但推送 API 的采用标准化了服务工作线程和跨主要浏览器(不包括 WebKit)的网络推送.

Short answer: developers don't have a choice in which Push Service the client uses, but the adoption of the Push API standardizes the service worker and web push across major browsers (excluding WebKit).

这篇关于自定义推送服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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