4

There are many questions about getting push notifications to work for web apps on iOS, eg. here. As of today it seems that it mainly (always) doesn't work because of the iOS browsers' lack of support for the Push API (likely because Apple wants people to build native apps instead).

Since I still want to continue building a web app I'm looking for alternative ways to solve this requirement/feature (notify the user that something has happened server side even though they don't have the web app active on their screen. This given they do have it open in a browser tab though).

So what is another way to inform a web app user that something has happened server side? I encourage you to think outside the box.

PS. Sort of off topic but my tech stack is NextJS and Firebase (Firestore, Auth, Cloud Messaging)

riper
  • 833
  • 1
  • 9
  • 17

1 Answers1

0

As long as the app is running in an open tab, how about Server-sent events or WebSockets?

Server-side events: "To enable servers to push data to web pages over HTTP or using dedicated server-push protocols."

activout.se
  • 6,058
  • 4
  • 27
  • 37
  • By "open tab", do you mean the tab has to be in the foreground? Server-sent events sounds interesting. Is that something you've tested or know others that have together with Safari on an iPhone? – riper May 17 '21 at 14:34
  • Find an online demo and try it? For example http://express-eventsource.herokuapp.com/ – activout.se May 17 '21 at 17:25
  • By open tab I mean that it you are lucky it works in the background for a while but it probably needs to be in the foreground on mobile. This is because radio communication is a big battery drain on mobile. – activout.se May 17 '21 at 17:28