Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow SNS Adapter to send to a topic #2444

Closed
wants to merge 6 commits into from
Closed

Allow SNS Adapter to send to a topic #2444

wants to merge 6 commits into from

Conversation

benishak
Copy link
Contributor

@benishak benishak commented Aug 3, 2016

A solution for this issue #2434
Allow user to specify a SNS Topic to send push to multiple users at once without overloading server by querying the Installations. You still can use AfterSave on _Installations to subscribe a user to a specific topic

use it this way

var ARN = {
        arn : [
            {
                topicArn : "arn:aws:sns:eu-central-1:XXXXXXXX:sandbox-topic",
                deviceType : "ios"
            }
        ]
    }


        return Parse.Push.send(
            {
                where: ARN,
                data: data
            },
            {
                useMasterKey: true
            }
        );

follow this PR of parse-server-sns-push
parse-server-modules/parse-server-sns-adapter#6

still falling because of test ...

I tested and work fine

@flovilmart
Copy link
Contributor

Please remove the lib folder as it's still part of the commits

@facebook-github-bot
Copy link

@benishak updated the pull request.

@@ -37,7 +37,7 @@ node_modules
.vscode

# Babel.js
lib/
lib
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove that change

@codecov-io
Copy link

Current coverage is 91.84% (diff: 100%)

Merging #2444 into master will decrease coverage by <.01%

@@             master      #2444   diff @@
==========================================
  Files            95         95          
  Lines         10708      10717     +9   
  Methods        1309       1309          
  Messages          0          0          
  Branches       1741       1743     +2   
==========================================
+ Hits           9835       9843     +8   
- Misses          873        874     +1   
  Partials          0          0          

Powered by Codecov. Last update f1c9d97...ff7ed5c

@flovilmart
Copy link
Contributor

It seems to me that this feature is highly specific to AWS SNS, can be achieved right away with the AWS SDK and besides using the Parse.Push semantics, don't leverage any feature from parse-server. What do you think @drew-gross ?

@drew-gross
Copy link
Contributor

I'm not much of a push user, I've never really built anything with push, or built any of the push components of Parse (except UI). @nlutsenko would probably know better.

@benishak
Copy link
Contributor Author

benishak commented Aug 4, 2016

I actually tried not to touch the Parse Server and just put the logic in the sns-adapter. I wanted that the PushController skip querying the Installations

@flovilmart
Copy link
Contributor

@benishak how hard would it be to implement it as a cloud code functions, i believe using the AWS node SDK directly would be easier and will make this corner case disappear, therefore easier to maintain that area for us.

@benishak
Copy link
Contributor Author

benishak commented Aug 8, 2016

I managed to do the same from Cloud Code using the same SNSAdapter.

var SNSPush = new SNSPushAdapter(config)

then in Cloud Code I can call

var ARN = {
        arn : [
            {
                topicArn : "arn:aws:sns:eu-central-1:XXXXXXXX:sandbox-topic",
                deviceType : "ios"
            }
        ]
    }

SNSPush.sns.send(data, ARN)

You can ignore this PR but please edit and accespt my PR for the parse-server-sns-adapter which support sending to Topic and the most important part of that PR is to re-enable Endpoints before sending push, which is an issue in SNS, because SNS permenantly disable and Endpoint even if it fail temporary!
https://forums.aws.amazon.com/thread.jspa?threadID=152300

@flovilmart
Copy link
Contributor

That seems to be cleaner that way, I'll check the other PR soon :)

@sprabs
Copy link

sprabs commented Aug 28, 2016

@flovilmart @benishak Can you also configure this for SMS or is the preferred method Twilio still?

@flovilmart
Copy link
Contributor

SNS is Simple Notification Service, which is a push infrastructure from Amazon. Not related to SMS...

@sprabs
Copy link

sprabs commented Aug 28, 2016

@flovilmart The name is misleading. There is SMS support: https://aws.amazon.com/sns/sms-pricing/

@flovilmart
Copy link
Contributor

My bad, In any case, if you think AWS is better than Twilio for sending SMS, you can use it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants