SNS and Node.js: subscribe multiple Endpoints (ARNs) to a Topic
I'm building a chat application for Android using a Node.js server..
When a user wants to open a new Topic/chat group, few things need to be done:
1. Create the Topic using Amazon's (AWS) SNS SDK.
2. Subscribe each one of the requested users to this Topic, using their AWS Endpoint ARN.
My question is on the Node.js AWS SDK, but corresponds to the AWS Android API as well as they currently work the same in this matter.
Question 1:
How do I subscribe multiple Endpoint ARNs in one call?
Currently I have to wait after each "subscription request" to make sure it is successful before I submit the next one. It takes too much time and effort.
Question 2:
In case a user wants to unsubscribe from the entire app, I delete his/her Endpoint from AWS-SNS.
BUT, their subscriptions to the various topics remain! So effectively, they still receive all the data/messages (and there is no app to receive it of course).
Please let me know if any code is needed.
* I thought maybe I would just put a json'd List with all the ARNs, but it did not work.