Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Push notifications #7
Great question. Before I start explaining, please correct me if I'm wrong. I think I have enough experience with push notifications (Jasonette started out as something extracted out from a messaging app.
As far as I know, push notification in most cases is a server-side thing. Let me use a messaging app as an example:
Of course, there is a way to bypass this. For example if Jane's phone knows exactly what John's
That said, there are many ways to tackle this problem.
The project is not yet at a stage where I want to make a decision on whether I will build a dedicated push broker service (Option 3) or not. And honestly I think building Jasonette into something that's tightly coupled with a "special server" may limit its potential.
I think option 2 feels most rational at this point, since you still have a way to send device tokens to your server without touching any native code, but you're not tied to a specific push provider.
But again, let me know if you know a better solution. Otherwise I will soon start working on the 'option 2' and post an update here :)
An action for sending tokens and new system event which would be fired when a push message arrives would be cool.
I fully agree that writing yet another push service backend would bind jasonette too tightly to one implementation.
OTOH I see that both UA and MS Azure require hooking their own frameworks on the client (iOS) side. I think makes it very difficult to come up with a generic solution for a system event.
Here's the push notification branch: https://github.com/Jasonette/JASONETTE-iOS/compare/push_notification?expand=1
I've just tested it and it works on mine, but as is always with push notifications you need to jump through a couple of certificate hoops.
I'm assuming you have an apple developer account, since that's the only way to support push notifications. Anyway, to make this work, you should:
Note that these are not Jasonette related steps but something anyone who wants to implement push notification on iOS needs to go through.
Once you're all set up, this is how the new API should work:
One more thing, I'm attaching the server-side code (it's an AWS lambda function but you can do whatever you want) I used to get it to work just in case. It's all hard-coded because it's just for validating the API:
If Anybody actually tries this out, please share the results. I would appreciate it. Then I should be able to merge this to master much faster.
Won't close this until I merge this with master.
Also, please feel free to point out if I'm missing anything from the diff