Hi all,

I am doing web services for an Android application which sends push notification. Below is the scenario:

  1. I have 100s of customers registered on the website
  2. Each user has his own subscribers list
  3. Each user can schedule the push notification to be sent at a specific time
  4. I will be running a cron file which will check for the messages to be sent

Now I want to know that let's say there are 5 users A, B, C, D, E

1) User A has scheduled 10000 messages to be sent at 1 PM
2) User B has scheduled 50000 messages to be sent at 1 PM
3) User C has scheduled 15000 messages to be sent at 1 PM
4) User D has scheduled 25000 messages to be sent at 1 PM
5) User E has scheduled 30000 messages to be sent at 1 PM

What will happen in this case?

The cron will run every 1 minute and based on the descending IDs from the message table it will pick records

So the loop will start at 1PM and will pick the record which was inserted in the end that is for User E
Then next minute it will pick User D message which will start at 1:01 PM

Like this the User A message will start at 1:05 PM but he has scheduled for 1 PM

This is a scenario of just 5 users what will happen when 100s of users will schedule at same time?

I need you guys to guide me and let me know a proper way to do it.

how Bulk SMS/Email solutions works when they have 100s of users scheduling at same time?

Any help in this regard will be highly appreciable...

regards

Hi Muslim_1

I would look into phpDaemon, it should help solve your problem, rather stay away from Cron to do this type of thing.

http://daemon.io/faq.html

I have had much success using daemons written with PHP. My thoughts are you could simply send all those messages simultaneously using something like phpDaemon.

@andrevanzuydam

Thanks for your reply.

Can you please share an example or some sample code which you have done to acheive this

I will see what I can do, the scenarios I have done this for are more complicated, I should be able to create a scenario for your situation. Will you be able to implement the phpDaemon service ? Running services in general requires some type of admin on the server.

@andrevanzuydam

No idea about this in any way. Could you please help me in this matter?

The first thing to determine is will your hosting provider allow you to run services and do you plan to setup the server yourself? The best operating system for running services for PHP is Linux, which you already seem to be running. It does not help I give you a solution and you are unable to implement it.

I have a VPS account on web hosting and I have root access too.

hello andrevanzuydam

Could you please help me

Any website can send web push notifications after installing Javascript code to enable them. Website visitors have to opt in to receive push notifications before they start receiving them. As part of the opt-in process, the browser displays a built-in prompt. This a browser-based opt-in prompt.
Website can also show a soft-ask opt-in prompt implemented with HTML/CSS/Javascript. This is a strategy for securing an opt-in other than than just showing the browser-based opt-in prompt without any additional context.
Once the visitor indicates to receive notifications through the soft-ask opt-in prompt, then the browser-based opt-in prompt is displayed. The visitor must opt-in the browser-based opt-in prompt to start receiving notifications.

How to implement web push notifications
You need to use a third-party service such as Webpushify.
The implementation steps are:

Create an account in Webpushify
Register your domain in Webpushify console
Install a JavaScript SDK (code snippet)
Start sending notifications using Webpushify console

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.