-
-
Save dev0x10/7dfc0fd49dfa26b0c60d to your computer and use it in GitHub Desktop.
Node.js Parse
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Parse = require("parse").Parse; | |
Parse.initialize( | |
"", // applicationId | |
"", // javaScriptKey | |
"" // masterKey | |
); | |
var query = new Parse.Query(Parse.Installation) | |
, data = { | |
"alert": "A message!", | |
"anotherObjectId": "", // extra data to send to the phone. | |
"sound": "cheering.caf" // default ios sound. | |
}; | |
query.equalTo("user", {"objectId": "" /* a user object id */, "className": "_User", "__type": "Pointer"}); // me. | |
query.equalTo("deviceType", "ios"); | |
Parse.Push.send({ | |
where: query, | |
data: data | |
}, { | |
success: function () { | |
console.log("arguments", arguments); | |
}, | |
error: function (error) { | |
console.log("Error: " + error.code + " " + error.message); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Install Parse framework for node.js via npm. | |
// http://blog.parse.com/2012/10/11/the-javascript-sdk-in-node-js/ | |
$ npm install -g parse | |
// Parse docs about Push Notifications with JavaScript. | |
// https://parse.com/docs/push_guide#top/JavaScript |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment