Questions tagged [web-push]

The Web Push API lets users of your Web app receive push notifications at any time—even in the background; that is, even when your Web app is not currently running in the foreground on the user’s device (or even when the browser on the user’s device is not currently running). It use Service Workers to handle messages sent using common push services, and to allow your Web app to react to the push notifications it receives.

For more information about the Web Push API, see the actual Push API spec and the articles Using the Push API and Push Notifications on the Open Web. The MDN article Using Service Workers is also relevant.

The IETF standards that describe the Web Push protocol and its message encryption scheme are really useful to understand how to build an application server that sends push notifications to clients and how to encrypt push message payloads.

639 questions
228
votes
10 answers

How to send push notification to web browser?

I have been reading for past few hours about Push Notification API and Web Notification API. I also discovered that Google & Apple gives push notification service for free via GCM and APNS respectively. I am trying to understand if we can implement…
esafwan
  • 17,311
  • 33
  • 107
  • 166
46
votes
7 answers

Push notification facility for mobile web app

I have a simple scenario, to receive notification on mobile devices whenever it's generated from Server. I know this facility is available in native iOS app and Android but I am trying to avoid native path. What I would like that: A mobile web app…
Volatil3
  • 14,253
  • 38
  • 134
  • 263
44
votes
7 answers

Chrome Push Notification: This site has been updated in the background

While implementing the chrome push notification, we were fetching the latest change from our server. While doing so, the service-worker is showing an extra notification with the message This site has been updated in the background Already tried…
42
votes
2 answers

Asp Net Core Web Push Notifications

Main goal is to add to site ability to send web notification to pop up a system notification to alert the user using Html5 Push API and service workers. Not using SignalR which only can run client scripts while site is opened. Also should be ability…
aleha_84
  • 8,309
  • 2
  • 38
  • 46
39
votes
2 answers

What is the difference between Push API and Server Sent Events?

From the documentation I could figure out that Push API and Server Sent Events both are half duplex but why two different technologies for the same functionality? Is there something more significant in Push API?
Rishul Matta
  • 3,383
  • 5
  • 23
  • 29
37
votes
5 answers

Service Worker Registration Failed

I am currently working on service worker to handle push notification in browser. Currently I am having this "SW registration failed error": SW registration failed with error SecurityError: Failed to register a ServiceWorker: The URL protocol of the…
Saugat Bhattarai
  • 2,614
  • 4
  • 24
  • 33
29
votes
2 answers

What is VAPID and why is it useful?

I've just learned about VAPID recently and have been looking around for the reasoning why it exists and what its purpose is. Mozilla's blog post explains that "including VAPID information will let us contact you if we see a problem", but I'm not…
mattrick
  • 3,580
  • 6
  • 27
  • 43
25
votes
4 answers

Open a custom url when clicking on a web push notification

I am implementing the Webpush ruby gem to send push notifications to users of my website. Server code: Webpush.payload_send({ message: notification.message, url: notification.url, # I can't figure out how to access this key id:…
BananaNeil
  • 10,322
  • 7
  • 46
  • 66
20
votes
5 answers

How to use process.env in a React service worker

I am trying to set-up a Firebase-messaging-sw.js file (for web push notifications). I am wondering if there is a way to avoid exposing my Firebase config data to the public as much as possible - though it might be revealed anyways? (I'm not too sure…
20
votes
6 answers

Uncaught (in promise) SyntaxError: Unexpected end of JSON input

I am trying to send a new push subscription to my server but am encountering an error "Uncaught (in promise) SyntaxError: Unexpected end of JSON input" and the console says it's in my index page at line 1, which obviously is not the case. The…
zoltar
  • 706
  • 2
  • 7
  • 20
19
votes
3 answers

Notification.requestPermission() throwing error on Mozilla

I' m trying to get notification for Mozilla. But it continuously throwing this error. The Notification permission may only be requested from inside a short running user-generated event handler. Here is my code. The same code is working fine on…
Jaber Kibria
  • 932
  • 3
  • 9
  • 29
19
votes
3 answers

Understanding How to Store Web Push Endpoints

I'm trying to get started implementing Web Push in one of my apps. In the examples I have found, the client's endpoint URL is generally stored in memory with a comment saying something like: In production you would store this in your…
Dominic P
  • 2,284
  • 2
  • 27
  • 46
18
votes
2 answers

How can I do push notifications in an HTML5 Web application?

I have a web application. I want to use the HTML 5 inbuilt notifications API to do push notifications from the server when the user is on a particular page. Is it possible?
Vickrant
  • 1,233
  • 2
  • 9
  • 15
17
votes
6 answers

Firebase web Push notifications is triggered twice when using onBackgroundMessage()

I really don't know what is going on with these things. I am using FCM web push normally for my website. I can receive the message on the website if I am in foreground or I receive the notification if I am in the background. So far so…
17
votes
4 answers

Gradle build configured signatory

I'm looking at the webpush-java code. I run into a problem attempting to build the project using gradle. (I'm a gradle newbie). :signArchives FAILED FAILURE: Build failed with an exception. What went wrong: Execution failed for task…
Daniel Freeman
  • 383
  • 4
  • 11
1
2 3
42 43