Push Notification for Chrome browser extension? - google-chrome-extension

I built this Chrome browser extension plugin and can't figure out if there is a way to receive a server message from my Backend service in the plugin pretty much like the push notification for iOS.
e.g. notifying the user an event (from the backend) has happened and display this message in the plugin
I spent time looking into Chrome extension's documentation. They don't seem to have API similar to push notification for the Chrome extension.
Is there any other way do achieve this?

Related

Web Push notifications across multiple devices

I was following this guide to setup Web Push notifications in our web app:
https://blog.elmah.io/how-to-send-push-notifications-to-a-browser-in-asp-net-core/
But unrelated to ASP.NET core, I would like to know if it is possible if these push notifications can be received across multiple devices, since I cannot seem to get this working (yet) during my first tests.
Let's say:
A user logs in into browser, for example Chrome (with same user, both mobile and desktop)
Registers for web push notifications on our app (on desktop)
we send a notification to the registered user
--> Can push notifications both be received on mobile AND desktop?
--> Is that registration linked to a device, or linked to the logged in user from browser? (or other?)
Currently I don't think it's possible to do this. (if someone would be able to show me otherwise, I'll update this)
The reason is because that when you subscribe for web push notifications, a serviceworker (= in background running javascript file) needs to be installed on your device to receive the notifications. If you allow notifications on desktop (for example), this doesn't mean the serviceworker will be installed on mobile.

Maintaining a persitant connection in a MV3 Chrome Extension

I'm trying to build a chrome extension that updates its badge every time some event happens on my server- in this case, my server is receiving a webhook from Zoom and then informing my chrome extension that the event occurred. From there my chrome extension will update a counter on its' badge, to show that the event occured. I'm trying to build it according to the chrome extension Manifest V3 but I can't find any info on how to do this correctly.
To my understanding, in Manifest V3 all client-side scripts must run in a service worker. That service worker starts up, runs some code, and then shuts down again. I was planning to open a websocket in my background script, which would have been fine under manifest v2, but I don't think you can do that any more.
My question is: How do I maintain a connection to receive data in my chrome extension? When I say data in this case I really just mean an event informing my chrome extension to update the counter on its badge.
Are there other routes besides keeping a websocket open in the background? I've looked around at things like Google Cloud Messaging but I don't think that was intended for what I would like to use it for.
Try to use an offscreen API, it was introduced some time ago by Google. You just need to check in which browser version this API is available.
This would give you an opportunity on having long living WS connection and communicate with service worker e.g. by runtime API.
EDIT:
offscreen API is available since Chrome 109

Send message from extension to GNome desktop application

I want to make a Firefox / Chrome extension that sends messages to a GNome application made in GTK. I have read something about D-Bus. But I am not clear if it is possible to use that API from a Javascript extension. Is there any method to send messages between browser extensions and GNome API?

Firebase Cloud Notifications in Chrome Extension

Is that working to make an Chrome Extension that can send Notifications to the user with getting the Informations from Firebase Cloud Service?
I will have an Extension, that i can send users informations with that have installed my extension on all Pages if the have Chrome opened...
Is there any tutorial? I cannot find anything about chrome extensions and firebase
I used this tutorial with some differences with FCM. On extension side I made all by this tutorial, on the server-side - by FCM tutuorial. It works, but at current time messages saved at FCM while browser is shut down don't come after browser open, looking for a bug.
Yes, it wouldn't save messages while browser is shut down.
As long as Chrome is running, even if the extension or app is not running, it is woken up to deliver a message.
The tutorial in the link of the previous answer is now deprecated. "As of April 10, 2018, Google has deprecated GCM.." Learn more here.
Now, you can implement Firebase Cloud Messaging to your Javascript project with this tutorial, See here

How to launch a chrome packaged app using a URL scheme

I have a chrome packaged app that I update form time to time - when I'm creating an update I want to send email to subscribed customers with a link the that extension -that will launch it.
Anyone knows if there is a chrome url scheme i can use?
Currently this is not possible, but there is an API proposal and an implementation being developed for a chrome-app://appid URL schema that would do pretty much what you describe.
Follow the status here
I also want to be able to do this. It seems that one possible solution is to install both an extension and a packaged app, and have the extension register a context menu that then communicates with the app, or something similar.

Resources