Post

Replies

Boosts

Views

Activity

Reply to Troubleshooting Safari-Specific Issues with PWA Push Notifications and IndexedDB
Hi, I would like to emphasize that I experience some how the exact same issue No. 2. There is no issue with other browsers / desktop versions, only iOS / Safari (i.e. PWA!) is behaving weired. The subscription is changing randomly. I've tried to get around by repeadetly checking the subscription information gotten from registration.pushManager.getSubscription() and compare with a local copy, and in case of differences, send the subscription information to my backend to get around this. This works very well for desktop / browser on desktop, but not really on iOS/PWA. From what I saw, it is not the pushManager, but the registration which was not given back correctly and therefore not pushManager.getSubscription() was possible. Nevertheless, and I believe this is the most important point: When there is no change to the application / pwa, why does the subscription information change, i.e. is not stable? Another thread on github (https://github.com/firebase/firebase-js-sdk/issues/8010) related to firebase and some kind of similar problem finally conviced everybody that this is actually a bug in Webkit. Actually Web Push Notifications are mission critical for my PWA and I would like to draw attention from Apple to this. My current sample implementation is: `self.addEventListener('push', function (event) { console.log("ServiceWorker: Eingehende Push Nachricht:", event); let data = {}; try { data = event.data ? event.data.json() : {}; console.log("Parsed Push Data:", data); // Benachrichtigung anzeigen, falls gültige Daten vorliegen if (data.head && data.body) { event.waitUntil(self.registration.showNotification(data.head, { body: data.body, icon: data.icon || '/default-icon.png', })); } else { event.waitUntil(self.registration.showNotification(('Unbekannte Nachricht', { body: 'Die Nachricht hat eine falsche Struktur', }))); } } catch (e) { console.error("Fehler beim Verarbeiten der Push-Daten:", e); event.waitUntil(self.registration.showNotification('Unbekannte Nachricht', { body: 'Die Nachricht konnte nicht gelesen werden.', })); } // Nachricht an alle Clients senden event.waitUntil(sendToClients(data)); });` Especially keep in mind the event.waitUntil() call for the showNotification at the end seemed to be quite important as cited by some other sites. I'm looking forward to get this issue solved soon.
Topic: Safari & Web SubTopic: General
Feb ’25
Reply to PWA PUSH NOTIFICATION ISSUES IOS 16.4+
Hi, I can confirm, this issue still persists and I don't know how to get rid of it. Subscription works initially. unlike others where it stops after 3-4 Web pushes (which I believe to be linked to not using event.waitUntil() for the local notification), but stops after some 100s of notification out of the sudden. I can reproduce this on following user agents: Mozilla/5.0 (iPhone; CPU iPhone OS 18_3 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.3 Mobile/15E148 Safari/604.1 Mozilla/5.0 (iPhone; CPU iPhone OS 18_1_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.1.1 Mobile/15E148 Safari/604.1 Maybe I'm not looking at the right place to properly do the subscription? Any help will be much appreciated.
Feb ’25