Unable to send push notification after 1 minute - php

I am facing one weird issue in Laravel Job/Scheduler. In my backend, I have created one functionality using which the admin can schedule push notification and send it to all users. So let say I have created one notification that sends a notification to all users at 2:00 AM. So at 2:00 AM one entry added to the Jobs table and start sending a push notification. but it will send push notifications for only 1 minute. After 1 minute it is stopping the push notification send process. I have more than 1k users on the notification list. But it is sending push notifications to only 50 user approx. I have used a scheduler for handling jobs.
Please help me. I have tried all possible ways from my end to identify the issue.

Related

Push notification timing

When I am using https://github.com/olucurious/PyFCM then I am not able to send push notification to other person with time
We need to send push notification to other person with 1 hours. How can I send push notification with time for 1 hours not all time.

Cancel pending push notification

I am sending push notification via APN from my server.
lets say, there is an event at 3 PM so for this at 1 PM i am sending the push notification to all of my users from my server that there is an event at 3 PM. Now, if some devices are offline (not connected to internet) then they will not receive the push notification right away instead they will get the notification when connected to the internet. So if user connects to the internet at 5 PM then there is no use of receiving the push notification at that time.
So my question is, can we cancel/stop this push notifications being sent after particular time?
Thanks in advance!!
You can send an expiration date, so the push notification will be discarded.
https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html

Algorithm sending email notifications

I am stuck with algorithm to mail notifications for users. Website is built on PHP 5.4 and MySQL 5.5 .
I have simple one-to-one messaging system built on the site I am working on, and these messages are stored in a database. The task is to send daily email at 9:00am with notification if user has some unread messages waiting for him.
The way how I accomplished it by now is this:
I run the script with cron (every 10 minutes) to collect rows after the last ID of checked message (ID is stored in 'notifications_work_table') from 'messages_table';
according to collected data, I count how many unread messages has each user on that database and then I make personalised message for each user, and store that message in 'mailing_queue_table' and setting the time to send this message at tomorrows 9:00am (if its past 9:00am this day), or to todays 9:00am (if it's past midnight this day). On 'notifications_work_table' ID is updated to last checked message id;
in parallel I run another script with cron (also every 10 minutes) to check if there are any messages to send, if the now() time is past to time when I need to send the message from 'mailing_queue_table'. In one try I send only 100 email messages.
The problems starts there, when user is online and is reading messages already on the fly. For example, user receives a message on 8:05, script, that collects unreads count (1st point) runs on 8:10, but user then reads this message on 8:12, then stored personalised message (3rd point) has false information laying there, and then I have to run again delete query to unset it from queue.
While writing this problem, I had a thought about that I could check for that if user has been online in some sort of interval, and then check should I send him a notification, or he is so active on site, that there is no necessary to store on queue and then send the mail.
Maybe you have some good literature or tutorial to do these things properly. For example, Facebook is great example of sending notifications, but good material is hard to find. Maybe you have some ideas, that you have went through in your programming life and could share with us.
Thanks,
/Rob

SNS and SQS Technical architecture

I am working on a blueprint to send and Receive email messages.I looking for best practice.
We have to send , for example 1000 messages on click of a button. How to Use SNS and SQS to send messages right away? Is it a good idea to create one SNS request to create 1000 message in a queue?
Is there any way to schedule 1000 messages ?
We receive messages, whats the best way to use SNS and SQS to process the messages?
It would probably be best to put 1 message on a queue on the button click so the user doesn't have to wait. Then have a different process that take messages off the queue and sends the emails or queues up another 1000 messages, one for each email.
Don't think of it as sending 1000 emails with the click of a button, thinking of it as scheduling an email job.
Don't know all that you are trying to do, but you probably also don't want to do a 1000 message load while the user is waiting for a response after a button click.
I would consider, have 2 SQS queues (at least), the first queue is used to schedule the batch job, on a mouse click you insert a single job, i.e. 'send this email to 1000 people' as Travis R suggested.
Another job could poll Q1, see the 'send these 1000 people this email, and it could then create 1000 SQS messages into Q2, one per email address.
A third process (perhaps multiple of them), would watch Q2 and send a single email from the list, and delete the message. Using this method you could throttle you send rate down quite a bit to adapt to your ISP's restrictions, either with the SQS settings, or by limiting how often you 'email a single email' job is schedule to run.
Also consider using amazons SES and setting up another process to monitor bounces and complaints - which you are bound to have if you are kicking off 1000+ emails at a time.

Trying to make an SMS Reminder Application

I am working on a web-application to make an SMS Reminder service, which takes various inputs from the user, like the user's name, his number, and the time he wants the reminder. The reminder is then sent through an SMS. I have the SMS Gateway part figured out for which I am using Zeep Mobile's API. I wanted to know how I can send an SMS on the time input by the user.
The database would have the user-id and the time, and I need to get my application to send an sms at the time. Any tutorials on similar lines would be great help.
Thanks in advance
Let's say your reminder interval is 1 minute and you are deploying on Linux.
1) Set up a cron-job to check your database every minute for possible reminders
2) If there are reminders to be sent, execute your sending script.
3) Mark sent reminders with a status (or similar) so you don't send them again.
Depending on what server your application is deployed, you would need to run some kind of service that would run continuously and send SMS whenever one is due.
One note though, since repeated database access is costly, you may like to load up Reminders that would need to be sent in a short time. The database should be accesses periodically with a reasonable time interval.

Categories