Skip to content
This repository has been archived by the owner on Aug 25, 2023. It is now read-only.

Receiving a 2nd notification before the 1st one has been fired (and aggreggating both of them) #74

Open
kael opened this issue May 26, 2017 · 1 comment

Comments

@kael
Copy link

kael commented May 26, 2017

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).

@gauntface
Copy link
Owner

This doesn't sound like a bug, there is no guarantee on the order of messages.

Why don't you just do a fetch() request to an API on your server when you receive a single push?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants