fragon
fragon

Reputation: 3471

Sending push using parse.com Cloud Code

I have a problem with sending a push notification from Cloud Code. I want to send Push after saving an AlertPoint object. My code looks like this:

Parse.Cloud.afterSave("AlertPoint", function(request) {
    Parse.Push.send({
        data: {
            alert: "Test push."
        }
    }, {
        success: function() {
            //push successsful
            }, 
        error: function(error) {
            //Handle error
            throw "Got an error" + error.code + " : " + error.message;
        }
    });
});

But the push is not sent and I get an error:

Result: Uncaught Got an error115 : Missing the push channels.

I would like to send the push to all registered users and I've seen code examples in which the push was sent without setting channels. What am I doing wrong and how to fix this error?

Upvotes: 0

Views: 86

Answers (1)

You have to subscribe all users in a blank channel and set the push to broadcast the message to this blank channel too.

Upvotes: 1

Related Questions