PHP timeout when sending thousands of push notifications - push-notification

I have implemented push notifications using service worker and from server I push the notification using the web-push-php library. When I have to send thousands of notifications, PHP timeout will occur. How to prevent this scenario?

In my WordPress Plugin for Web Push (unmaintained now) I used curl multi to speed up sending notifications.
Take a look at this class: https://github.com/mozilla/wp-web-push/blob/master/wp-web-push/web-push.php.

Related

I need to create a web app which need push notification without FCM/GCM or APN

I need to send push notification even the site is closed, So I've tried service worker and web worker even web socket but it didn't works fine. It need FCM(Firebase Cloud messaging) to transfer payload from server
,but my server don't support Nodejs so I can't use Firebase
I need a solution to create a custom endpoint to delivery payload to a client in the Background. So, I can push a notification from the Service worker instantly even the site is closed

Firebase: How to send push notifications in batches to avoid problem with backend overload?

We have an app (iOS, Android) where we send push notifications to from the Firebase web interface to all the registered users.
The backend system cannot handle the peak load that occurs when all the users are pulled into the app calling the REST API from the push notifications.
Is there a way to split the registered users to send the push notifications little by little at an appropriate rate?
I suspect that this has to be done programmatically. C#?
Question with workarounds handling peak times when sending push notifications
The web console for sending notifications with Firebase Cloud Messaging does not have a way to throttle message delivery. It's an interesting concern though, so I'd recommend filing a feature request.
For the moment though, I can think of two options:
Create multiple audiences that cover your entire user base, and then send to each audience at a different time.
Use the FCM API to send out the messages to your users in batches.

Push notifications API for Appcelerator

Is there way to send push-nofications in Appcelerator not from console (https://platform.axway.com/)?
For example does Appcelerator have custom API to send push-notifications? e.g. our server sends request to appcelerator API and it sends push-nofication to devices.
There are tons of free and open source modules out there with which you can set it up yourself. Some rely on services like Onesignal, others are completely open.
Keep in mind, for iOS you don't need a module, you just get the token (as per docs) and then you just send it to your backend and it works.
A good module for Android with which you can use your own backend is Ti.Goosh
Yes you can use axway REST API to send your push notifications.
https://docs.appcelerator.com/platform/latest/#!/guide/Push_Notifications

Can we poll for notification from service worker

When implementing push notifications using service worker, we can directly push the notifications to the endpoint. But in my website the notifications are fetched from an outside API. So Is there any way from my service worker to poll for notifications so that I can identify if a new notification is present?
If your web application is open, you can show notifications by checking for some criteria (polling an API, etc.) and then using the Notifications API.
This does not require a service worker. Using a service worker + push events to trigger your notifications means that your notifications will appear even if your web application is closed, and it also is more efficient to rely on listening for push events vs. repeatedly polling an API.
You could theoretically use a combination of polling and explicitly calling the Notifications API when your web app is open in addition to registering a service worker that listens for push events. But if you're putting in the effort to support the service worker use case, just relying on the service worker for all of your notifications might be cleaner.
One difference between the two approaches is that using the Notifications API while your web application is supported in more browsers (as of August 2017) than service worker-based push notifications.

Read Notification via web

I want to implement a push notification service. The idea is to use the GCM Service. Is it possible to read the notifications both via web app (the app is written in php using laravel) and via mobile app for the authenticated users using the same technology?
I think it is possible, I also see this tutorial that can help you to achieve that. It also use PHP as a sample, so it seems like your work will be easier:)
It explains here the basic steps that you need to achieve push notification. It has a sample code and a screenshot to make you understand more the content of this tutorial.
In developing this application, it involves two parts, a GCM Server Application that create Web application using Php to send message to User via GCM Cloud server and GCM Client Application that create Android application which receive messages sent from GCM Server Web App.
For more information you can also check this links:
Implementing Push Messaging for Chrome
How to send push notification to web browser?

Resources