Receive push notifications (FCM/GCM) for Firefox addon
Categories
(WebExtensions :: General, enhancement)
Tracking
(Not tracked)
People
(Reporter: sonesson8909, Unassigned)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36
Steps to reproduce:
I am developing an extension, both for Chrome and Firefox.
I want to be able to receive push notifications from Firebase. For the Chrome version I can use the gcm-API (https://developer.chrome.com/docs/extensions/reference/gcm/) to register to Firebase and receive messages. I have used an approach similar to in this tutorial: https://www.plasmo.com/blog/posts/firebase-cloud-messaging-chrome-extension
But for the Firefox version I can't seem to use gcm and I haven't been able to find any equivalent of gcm to do this. Is there any way for a Firefox extension to register to Firefox and receive messages in a similar way?
Actual results:
"chrome.gcm is undefined". In other words it is not available for Firefox addons.
Expected results:
I want to find an equivalent solution for a Firefox addon to connect to Firebase and receive push notifications.
Updated•2 years ago
|
Comment 1•2 years ago
|
||
Thank you for submitting this request.
Setting this as NEW and waiting for the developer to share his thoughts on this.
Comment 2•1 year ago
|
||
The GCM API is tied to Google cloud infrastructure and unlikely to be supported in Firefox.
The generic capability, subscribing to messages from some backend can be implemented yourself. There are many options available:
- Server-sent events (EventSource): https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
- WebSockets
- Push API: https://developer.mozilla.org/en-US/docs/Web/API/Push_API
(Push API is service worker only, service workers are currently not supported in Firefox extensions - bug 1573659).
Description
•