Pushpad
Articles › Sending Notifications, Web Push Notifications

Send notifications in batch with the Push API

APNs an GCM have always provided a way to send notifications in batch.

It would be useful to see this feature for the Push API, which unfortunately doesn't have it yet, meaning that you have to make an HTTP request for each endpoint. If you want to send a web push notification to N users at a time with a single API request you can still use a service like Pushpad which makes the hard work for you.

This feature would greatly reduce the workload on the app server (and also on the push service). Connection keep alive is not enough. There should be a way to make a single HTTP request for more endpoints.

At least this feature should be provided when there is no payload.

For example this three POSTs:

https://updates.push.services.mozilla.com/push/v1/endpoint1
https://updates.push.services.mozilla.com/push/v1/endpoint2
https://updates.push.services.mozilla.com/push/v1/endpoint3

could be rewritten as a single:

POST https://updates.push.services.mozilla.com/push/v1/

{
  endpoints: ["endpoint1", "endpoint2", "endpoint3"]
}

The app server should be able to find the shared prefix in the url and trigger a single request. For the push service it shouldn't be difficult to provide that method (a 404 would mean I don't have this feature yet).

If this feature won't be implemented the only hope relies in HTTP2 multiplexing. However that would be still more inefficient (e.g. N headers for N endpoints) and probably more complex to implement. Library support for HTTP2 is still limited and no push service is known to support it at the moment.