web-push-libs / web-push

Web Push library for Node.js
Other
3.28k stars 304 forks source link

iOS and Apple #808

Closed labrocca closed 1 year ago

labrocca commented 1 year ago

NOTE: Please test in a least two browsers (i.e. Chrome and Firefox). This helps with diagnosing problems quicker.

Setup

Please provide the following details, the more info you can provide the better.

Operating System: <Linux | Windows | OS X> Node Version: <4.2 | 6.0 | ...> web-push Version: <1.0.0>

Please select any browsers that you are experiencing problems with:

Please list the browsers you are have tested this, including the version of the browser (i.e. Chrome Beta, Firefox Beta etc).

Problem

Please explain what behaviour you are seeing.

Expected

Please explain what you expected to happen

Features Used

Example / Reproduce Case

Please provide a code sample that reproduces the issue. If there is a repository that reproduces the issue please put the link here.

Other

Please put any remaining notes here.

Since this year iOS now handles Web Pushes on Apple iPhones, will this be updated to support it?

khromov commented 1 year ago

Since this year iOS now handles Web Pushes on Apple iPhones, will this be updated to support it?

This library already works with Safari + iOS, I've tested it.

labrocca commented 1 year ago

Since I don't have an iOS device I'm not able to really test myself. Are you saying that the current setup I have which works on desktops (Apple, Windows), Chrome, and other browsers will work on iOS Safari without any edits or updates?

khromov commented 1 year ago

@labrocca It should, but there are some caveats. For example on iOS, a person has to add the app to their home screen via the share menu first, then launch the app from the home screen icon (which resets all cookies/localstorage), and then subscribe to push based on a callback triggered on a user gesture such as clicking a button.

Provided you handle the push registration correctly with Notification.permission and serviceWorkerRegistration.pushManager.subscribe etc. (which this library does not really help with as far as I understand), then it will work correctly.

PS. You need a physical device to test this. When I was trying it out in the XCode Simulator it did not work, as the Simulator cannot create push tokens at all.

labrocca commented 1 year ago

Does the library work with the release 3.2.2 or do I have to update the code, I see a lot of recent edits.

Also, thank you for the responses. I'm very bad at JS (PHP Coder) and I'm afraid I will break my existing working notification trying to get Apple to work.

khromov commented 1 year ago

@labrocca The GitHub tags do not seem to be updated, the latest version on NPM is 3.6.3 which works. I cannot answer if a version from 2017 works or not.

https://www.npmjs.com/package/web-push