I’ve finished the book, and got to know how to send push notifications on a local server, but I still can’t figure it out how to do it on a production app on a real server.
Like, if I make a rss reader app, and set my server on AWS, and I using push notifications to update articles on every rss feed, isn’t that the only thing I need to do is upload the WebService folder to the AWS server? but how could I let the AWS knows what RSS feeds are in user’s app? and how should I let AWS do it automatically? In the book the payload is added and send manually.
I’m totally beginner at the backend, should I also read the book Server-Side Swift with Vapor?
Unfortunately what you’re asking is an implementation detail specific to Amazon. You might try looking here: Mobile push notifications - Amazon Simple Notification Service
That should help you figure out how to configure/send push notifications from AWS (I’ve never used them, sorry).
As to “what feeds are in the user’s app”, you would need to send that to your server/database. Essentially when the person subscribes to a feed, you send some type of API call to your server telling it that person wants that feed. When you update the feed, your server would then ask the database for all APNS tokens that are subscribed to the feed, and then it would send a silent notification telling the app there is new content available to be dowloaded.
@gargoyle Thanks for the reply.
For this rss reader app I was talking about, now I know how to send the feeds user subscribes to the server, the part I don’t know is how to do the next.
Like I got the feeds now on my server, but how I check if there’s new content of each feed? I mean, I could done this easily on the local iOS app, just write a Swift function like refreshFeeds()
… but how should I do this on server? Now I could use a GET request in a vapor controller to fetch the feeds table, but just have no idea what to do next.
I think the process is like this:
- got feeds from app
- send it to the server
- check new content of each feed at some intervals
- if there’s new content, wrap it on a payload and send it back to user through push notification
Isn’t that right? if so, the parts I don’t know is 3 and 4.