Advertisement
Guest User

Untitled

a guest
Aug 21st, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. const apn = require("apn");
  2.  
  3. let tokens = ["<insert token here>", "<insert token here>"];
  4.  
  5. let service = new apn.Provider({
  6. cert: "certificates/cert.pem",
  7. key: "certificates/key.pem",
  8. });
  9.  
  10. let note = new apn.Notification({
  11. alert: "Breaking News: I just sent my first Push Notification",
  12. badge: countSendedPushes()
  13. });
  14.  
  15. note.topic = "<bundle identifier>";
  16.  
  17. service.send(note, tokens).then( result => {
  18. console.log("sent:", result.sent.length);
  19. console.log("failed:", result.failed.length);
  20. console.log(result.failed);
  21. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement