Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I use service worker with socket-io?

I want to push notification to desktop and mobile. For that I following this article: https://developers.google.com/web/updates/2015/03/push-notifications-on-the-open-web?hl=en

I have two question:

  1. Can I use push notification to send notification after all tabs are closed (Chrome restart?)
  2. Can I trigger the notification by using socket.io for example io.on('message') instead of GCM?
like image 616
Aminadav Glickshtein Avatar asked May 23 '16 12:05

Aminadav Glickshtein


1 Answers

Two questions, Two answers:


Can I use push notification to send notification after all tabs are closed (Chrome restart?)

Yes. The notification can be sent for Desktop Chrome, and Android Chrome, after chrome is closed. using Notification API.


Can I trigger the notification by using socket.io for example io.on('message') instead of GCM?

No. The service worker is not working in the background, while the browser / tabs are closed. The only way to wake up the service worker is by using GCM.

like image 105
Aminadav Glickshtein Avatar answered Sep 30 '22 03:09

Aminadav Glickshtein