Sending push notification every 20 seconds with PHP and check for response

726 views Asked by At

When I get sendRequestToMembers request from the App, in server side, I've to send push notification to group of members in queue. For example for a group of 15, I've to send notifications to the first five, wait for 20 seconds, and if no member has accepted the request, send to the next five members. If anyone has accepted the request stop the loop and send a response to the app. Or at the end of the loop if no one accepted the request, send some other response to the app.

I'm using PHP. How can I wait for 20 seconds before checking for any accepted request?

If I use wait(20) the whole thread will stop responding, and request would time out. Cron is not useful for jobs less than a minute.

Any suggestion?

0

There are 0 answers