Firefox 的 GCM 等效项 [英] GCM Equivalent for Firefox

查看:36
本文介绍了Firefox 的 GCM 等效项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google Cloud Messaging (GCM) 是一项服务,可让开发者将数据从服务器发送到 Android 应用或 Chrome 应用和扩展程序.

Google Cloud Messaging (GCM) is a service that enables developers to send data from servers to both Android applications or Chrome apps and extensions.

我正在开发 chrome 和 firefox 扩展/附加组件.我正在使用用于 Firefox 扩展的 Web 扩展 API.

I am developing a chrome and a firefox extension/add-on. I am using the Web Extension APIs for Firefox extension.

现在,Web 扩展 API 还不支持 chrome.gcm.* API.本质上,firefox 扩展不能与 GCM 通信.

Now, Web Extension APIs don't support chrome.gcm.* APIs yet. Essentially, a firefox extension cannot talk to GCM.

firefox 扩展是否可以与之通信,例如 GCM?Firefox 提供的东西就像 Google 为其浏览器 Chrome 提供的 GCM 一样?如果没有,有人可以解释如何在 Firefox 扩展中实现这一点吗?

Is there something else like GCM to which a firefox extension can talk to? Something provided by the Firefox just like GCM provided by Google for its browser Chrome? If not, can someone please explain how to achieve this in a Firefox Extension?

更新:即使对于网络应用程序,firefox 也不使用类似于 GCM 的东西.他们使用服务工作者.Firefox 浏览器扩展可以与 Service Worker 交互吗?

Update: Even for web apps, firefox doesn't use something similar to GCM. They use service workers. Can Firefox Browser Extensions interact with service workers?

推荐答案

Firefox 扩展目前无法直接使用 Service Worker (据一位在 Firefox 中从事 service-workers 支持的实现者说).

Firefox extensions currently can’t use service workers directly (according to an implementor who worked on service-workers support in Firefox).

firefox 扩展是否可以与之通信,例如 GCM?Firefox 提供的东西就像 Google 为其浏览器 Chrome 提供的 GCM 一样?

Is there something else like GCM to which a firefox extension can talk to? Something provided by the Firefox just like GCM provided by Google for its browser Chrome?

是的,有一个相当于 GCM 的 Firefox.Firefox 用户访问的所有接收推送通知的 Web 应用程序都从 dom.push.serverURL 用户首选项提供的服务器获取它们.如果您在 about:config 中检查 dom.push.serverURL,您将看到 wss://push.services.mozilla.com/,这是 Mozilla 推送服务——本质上,Mozilla 相当于 GCM.

Yes, there’s a Firefox equivalent of GCM. All Web apps a Firefox user accesses that receive push notifications get them from a server given by the dom.push.serverURL user preference. If you check dom.push.serverURL in about:config, you’ll see wss://push.services.mozilla.com/, which is the Mozilla Push Service—essentially, Mozilla’s equivalent of GCM.

它的后端运行 AutoPush,这是一个基于 Python 的开源软件推送服务器软件项目,并且它的客户端(如问题中所述)通过服务工作者暴露给 Web 应用程序.

The backend of that runs AutoPush, a Python-based open-source Push Server software project, and the client side of it is (as noted in the question) exposed to Web apps through service workers.

因此,虽然 Firefox 扩展可能有另一种方式可以连接 Mozilla 推送服务,但唯一公开记录的方式是通过 标准 Web 推送 API 依赖于服务工作线程,这些 API 尚不可用于 Firefox 扩展.

So while there may be an alternative way Firefox extensions can connect with Mozilla Push Service, the only publicly-documented way is through the standard Web Push API that relies on service workers, which are not available yet for use in Firefox extensions.

这篇关于Firefox 的 GCM 等效项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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