Answer the question
In order to leave comments, you need to log in
How to implement a notification system for a cross-platform application (notification or push - notification | JS + PHP)?
There is a PHP backend. There is a phonegap application (html+css+js).
The bottom line is, the user has a subscription in the application.
You need to send him a notification 3 days in advance (for example) that the subscription will be canceled soon.
How to receive these notifications on the phone using js?
Should these alerts be removed from the database after the user has viewed them?
There are thoughts about setTimeout with an interval of 5 seconds (for example), i.e. call the checkNotification function every 5 seconds, in which there will be an ajax request. But isn't it going to strain the server a lot when there are a lot of users?
Please let me know if anyone has any thoughts on this. In general, are there any ready-made solutions or which method would be optimal?
By the way, cordova has a push-notification plugin, but maybe there is a way to just get by with js + php?
Answer the question
In order to leave comments, you need to log in
MadPirozhok on a PHP server, write a query that selects all users whose subscription expires in the next three days, then send a PUSH message (look towards onesignal.com) or an email.
Run this script once a day in the morning - the user will be warned three times before canceling the subscription.
The easiest way :=)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question