In Short:
This question is not about the process of sending a notification, nor is it how to store data into a database. This question is about how to have the server register itself for a timed event so that a block of my code can be executed - which would send out a notification.
The database would contain all the notifications that need to be sent along with it's time, of course the timing of each notification can be processed at different times depending on the fire date. I'm interested in figuring out how the server would achieve something like this?
I could be pushing thousands of push notifications an hour. So this scheduler would need to be able to manage the database reading and ensuring that the right notifications are triggered on time based on the fire date.
In Detail
Imagine a a game where a team player can decide when an event will begin on behalf of his team. He decides that the event will take place tomorrow noon. The server should trigger an apple push notification 30 minutes before the event notifying players to get ready.
I know how to send push notifications from my server - an amazon linux instance. I am using Amazon's SNS service to propagate these push notifications. However, I don't know how to schedule these push notifications server side so that they fire based on the timed events stored in the database.
I was thinking the following schema: 1) Notification arn end point - the address amazon SNS uses to identify each device 2) time to Fire (notification, this would be the event date minus 30 minutes for example) UTC timeestamp 3) fired - boolean enum to dictate whether the push notification was successfully sent from the server (not interested in delivery). 4) perhaps something else.. not sure yet
How would something like this be processed?
On an iPhone local notifications can be set up to 64 of them, you simply specify time of trigger, and when the time hits the notification is triggered. Is there something like this for the server, where timed events can process a block of my code?
My current setup:
- Using Laravel, a php framework to build my RESTful API server.
- Amazon linux instance
- Amazon SNS service.
- apple devices for client side.
I don't wish to register UILocalNotifications as I wish to be responsible for the firing of notifications hence the question.
Aucun commentaire:
Enregistrer un commentaire