Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GCM Equivalent for Firefox

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

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

Now, Web Extension APIs don't support chrome.gcm.* APIs yet. Essentially, a firefox extension cannot talk to 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? If not, can someone please explain how to achieve this in a Firefox Extension?

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?

like image 871
discoverAnkit Avatar asked Feb 01 '16 08:02

discoverAnkit


1 Answers

Firefox extensions currently can’t use service workers directly (according to an implementor who worked on service-workers support in 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?

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.

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.

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.

like image 109
sideshowbarker Avatar answered Sep 22 '22 11:09

sideshowbarker