0
votes

I have a React Native application that works on iOS and Android and I am looking to integrate AWS SNS. I have some questions that I hope people with SNS experience could answer.

  1. From my understanding, AWS SNS is merely a gateway for using GCM (Android) and APNS (iOS)
    • Is this correct?
  2. If the above is correct, imagine that I have an Android-only app, what's the point of using AWS SNS when I could directly use GCM/Firebase? I can even use Firebase with iOS.
  3. My app needs to allow a single User to send a notification to one or more Users.
    • Is there an RESTful API I can consume to achieve this?
    • Or would I need to set up API Gateway and use Lambda functions?
  4. How do I automatically store tokens on SNS?
    • I read that I have to integrate AWS Cognito for this, or use a Proxy Server.

Edit: I've managed to write a Node.js server that uses the aws-sdk to communicate with SNS.

Questions corresponding to their above question numbers

  1. Still looking for answers
  2. Still looking for answers
  3. I've written a Node server, I suppose I could embed the aws-sdk code into my React Native app as it can use Node APIs
  4. For question #4 - I used createPlatformEndpoint
1

1 Answers

0
votes

I am no specialist but given you have not received an answer yet, I thought I would try to help

  1. you can use AWS SNS to send messages via GCM, but it can do much more, since it's a pub-sub service: for example, if can be configured to receive email complaints from mails sent by AWS SES, and then you get either either a lambda function or a queue (SQS) to receive those actions emitted by SNS, allowing you to act on them
  2. for an Android-app only I don't see a good reason to bother, and even if it was also on iOS, you could configure yourself the sending of push notifications with an if/else in your code. I could argue it's a matter of personal taste, whether you want more configuration in your code vs in the infra-structure (I know the limit can get blurry), but it seems so much easier to keep it in the code that I wouldn't believe a word I said

My app needs to allow a single User to send a notification to one or more Users.

If it's a user writing to 1 to a few users, like in a messaging app, I would say it's easier to define (and maintain) the logic within your app and iterate over the group of recipients to send the push notifications.

If you're going to have a few people who are going to be followed by thousands of people and needs to write to them, you might have a case for using SNS Topics (each "popular user" can write - maybe via your own api - to an SNS topic to which the "followers" subscribed; keep in mind the max number of topics you can create), as SNS will take care of any scaling issue (it can take time and resources to send a push notification to your 1 million followers)

  1. What you said if you're going to user SNS, otherwise sending a push notification via GCM/FCM is as simple as a POST request.