Right now, Safari fires push events sequentially, as in it fires the event, then waits for all the event.waitUntil calls to settle, before it fires the next one.
Assuming that events are generally processed like this:
- Look at push payload
- Show notification based on that payload
Or:
- Look at push payload
- Make network request for data
- Show notification based on payload + response
In cases where the device has a queue of push messages, it seems advantageous to batch these into a single event. This would allow developers to make a single network request, rather than a series of network requests, and be smart about the notification displayed, e.g. "You have 7 new messages".
There's prior art here with getCoalescedEvents.
This would need to be opt-in as part of pushManager.subscribe, eg:
await serviceWorkerRegistration.pushManager.subscribe({
coalesce: true,
});
Right now, Safari fires
pushevents sequentially, as in it fires the event, then waits for all theevent.waitUntilcalls to settle, before it fires the next one.Assuming that events are generally processed like this:
Or:
In cases where the device has a queue of push messages, it seems advantageous to batch these into a single event. This would allow developers to make a single network request, rather than a series of network requests, and be smart about the notification displayed, e.g. "You have 7 new messages".
There's prior art here with
getCoalescedEvents.This would need to be opt-in as part of
pushManager.subscribe, eg: