mardi 29 septembre 2015

Best setup for GCM based mobile push on AWS

I am creating a backend service running on AWS, and I will have mobile clients on Android and later on also on iOS. I need mobile push functionality in order to push events from the backend services to the devices.

Now, I am having several concerns on what the best setup is:

  • What is the benefit of using AWS SNS to implement mobile push? For GCM, it's easy enough for my backend service code to make a HTTP call to the GCM API to publish a message.

    I know that SNS can act as a wrapper for multiple push service implementations including GCM and APNS, and I was thinking that this would help hide the details about what kind of device is used etc from the backend services, but since you need to create one "SNS platform application" for each bearer anyway, I'm not so sure - will my backend code still need to know which kind of device it wants to talk to and go about publishing downstream messages differently for Android vs iOS? I can imagine it would be easier than having to write completely different code for pushing messages down GCM vs APNS, but will it be significantly simpler?

  • If using SNS to wrap GCM, what is the best procedure for registering device endpoints? I have struggled to find a decent tutorial for this, and the only one I have found so far does it like so:

    1. Android app running on device registers with GCM using Google Play Services API

    2. Android app running on device registers a SNS platform endpoint based on the GCM token, using e.g. AWS Cognito credentials to access the account

    3. Android app running on device stores the platform endpoint ARN in the backend user database etc, to be used when a push message needs to be sent to the device

    I guess it would also be possible to have the device perform only step 1) and then pass the GCM token to my backend service which would create an SNS endpoint from it and store that in the database? This would prevent my devices from having to handle AWS credentials etc. But then I would have to implement GCM/APNS specific functionality on my server.

    Is the handling of expired/rotated GCM tokens a factor in how this procedure should be set up? Is it a good idea to store only the AWS SNS endpoint ARNs in my user database?

  • Are there other benefits of using SNS as opposed to directly calling GCM/APNS/... ?




Aucun commentaire:

Enregistrer un commentaire