Trying to bypass the size limit of push messages, I'm sending several push notifications that get aggregated by the browser.
But sometimes, irregularly and randomly, the 2nd notification is received before the 1st one is fired.
Then calling registration.getNotifications
when the 2nd notification is received returns an empty array, the 1st one hadn't been fired.
To circumvent that, on server-side I'm sending notifications using setTimeout
, something like that:
notifications.map((notification, index) =>
setTimeout(() => sendNotification(notification), 150+index*150)
)
On client-side, I'm trying to force sequential firing of notification using setTimeout
, but unsuccessfully.
Is there a way to aggregate these notifications when they're received in a very short delay ? Or would it be a bug ?
This happens on Android Chrome 59, Beta and Dev, and on Chrome 59 (Linux).