Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const apn = require("apn");
- let tokens = ["<insert token here>", "<insert token here>"];
- let service = new apn.Provider({
- cert: "certificates/cert.pem",
- key: "certificates/key.pem",
- });
- let note = new apn.Notification({
- alert: "Breaking News: I just sent my first Push Notification",
- badge: countSendedPushes()
- });
- note.topic = "<bundle identifier>";
- service.send(note, tokens).then( result => {
- console.log("sent:", result.sent.length);
- console.log("failed:", result.failed.length);
- console.log(result.failed);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement