1234567891011121314151617181920212223242526272829303132333435363738 |
- const apn = require('@parse/node-apn');
- const tokens = ['<insert token here>', '<insert token here>'];
- const service = new apn.Provider({
- cert: 'certificates/cert.pem',
- key: 'certificates/key.pem',
- });
- const note = new apn.Notification({
- alert: 'Breaking News: I just sent my first Push Notification',
- });
- note.topic = '<bundle identifier>';
- console.log(`Sending: ${note.compile()} to ${tokens}`);
- service.send(note, tokens).then(result => {
- console.log('sent:', result.sent.length);
- console.log('failed:', result.failed.length);
- console.log(result.failed);
-
-
-
- service.shutdown();
- });
|