{"_id":"@alqatech/node-apn-http2","_rev":"1-6b4c9b3f2468d09dc855e492d4092b34","name":"@alqatech/node-apn-http2","dist-tags":{"latest":"1.2.3"},"versions":{"1.2.3":{"name":"@alqatech/node-apn-http2","version":"1.2.3","description":"Communicate with Apple Push Notification Service via native Node.js v10+ HTTP2 module (node-apn drop-in). A fork of petercv's fork of andreialecu's package.","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1","prepublish":"tsc -p ."},"repository":{"type":"git","url":"git+ssh://git@github.com/alqatech/node-apn-http2.git"},"author":{"name":"AlqaTech","email":"info@alqatech.com","url":"https://github.com/alqatech"},"contributors":[{"name":"AlqaTech Team","email":"info@alqatech.com","url":"https://github.com/alqatech"},{"name":"Andrei Alecu","url":"https://github.com/andreialecu"},{"name":"Peter Verhage","email":"peter@egeniq.com","url":"https://github.com/petercv"}],"license":"MIT","engines":{"node":">= 10.0.0"},"dependencies":{"jsonwebtoken":"^8.5.1"},"devDependencies":{"@types/jsonwebtoken":"^8.5.1","typescript":"^4.2.4"},"gitHead":"c37a08cc23965b2be67afab6cc637d3588185f5f","bugs":{"url":"https://github.com/alqatech/node-apn-http2/issues"},"homepage":"https://github.com/alqatech/node-apn-http2#readme","_id":"@alqatech/node-apn-http2@1.2.3","_nodeVersion":"14.16.0","_npmVersion":"6.14.11","dist":{"integrity":"sha512-bW3bfFH4oHNkKWdy1hkBOOWMeeNWZmSGWmHQuLer3CG3BdqHk7Bkgtldv3WGRsMj5kCvQf9m06hCtshXicowDw==","shasum":"408f800fa89d99d8ac9e07540877bb35d4b4f60c","tarball":"https://registry.npmjs.org/@alqatech/node-apn-http2/-/node-apn-http2-1.2.3.tgz","fileCount":28,"unpackedSize":47177,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJhKLAaCRA9TVsSAnZWagAA92AP/1oz4lc1Ve7CuZqZbETc\n8XQtTntXT9GH/LG6w0siOkn6dTg4SlExoqzxKcEXzZFCLdCLnEHZHOmbBKW2\nHHPWI5u26Z07Rudunl5t3Zp+4GZQ+2jBzkh0zsKqbFo+4mOEoe+eZ8OfSGkE\nckHBFutPILnaq4gT0D9Aldn5rJ/xKW7tY0hTJdw/O2pFCKJvZAPVkVrD59y/\n9QkNuDa93q+3gGctjfRIprVejXZa5DtQ+58zhzc013qwbuwPdw4K/GKf03+c\nEzw++mXEYT37n1X8njOOqXRhuetlTStwEhsBl7QOrQWhwvd21yJXuoYwcm+U\nL1QpbP3QTvXeS/pP7Y7oI8t8i1FnAao6qx6jBH8GpJN4m65XS/vvtBwnhqsj\nY/Io5kWoRcglCtjy3n3M22vcON+FH3tkkNmQP4RBzp5tSMHfXlMpCQX5urHs\nPrMuUawPv0/QNps1AYFdpLuuqffdtpLBLUMGqvr86YavuxNoZRcFX9v3FWNs\nuXkMTqVe8pqob2Py3Fz1Xx7bDGairrpYYlJOdXEPv0RP6mRZ39N+U/Pe1+Qa\n7pXJWeaRvSmIfAVn5vd3iyyKAC+gbJkPHRDcS4tn9nYEaIBCYxzFCFC9uYWS\ngkiVvKWCCy1gkwLlO2fGD6MSWT3X5K7maCBnXgPE4X2P1BhPkFUZ2wJfBxHR\nqfHi\r\n=heJl\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGpu4k5lC3qahbPLbGz5GUELRQIIra/2MAH3tfWpdL2IAiEAtBNHczCWU2Vv4CmIauwBuXQ9wOhRqOfezUH/YBJvF2E="}]},"_npmUser":{"name":"imraniqbal","email":"alqatech@gmail.com"},"directories":{},"maintainers":[{"name":"imraniqbal","email":"alqatech@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/node-apn-http2_1.2.3_1630056474523_0.5637813514491163"},"_hasShrinkwrap":false}},"time":{"created":"2021-08-27T09:27:54.451Z","1.2.3":"2021-08-27T09:27:54.698Z","modified":"2022-04-04T13:38:47.336Z"},"maintainers":[{"name":"imraniqbal","email":"alqatech@gmail.com"}],"description":"Communicate with Apple Push Notification Service via native Node.js v10+ HTTP2 module (node-apn drop-in). A fork of petercv's fork of andreialecu's package.","homepage":"https://github.com/alqatech/node-apn-http2#readme","repository":{"type":"git","url":"git+ssh://git@github.com/alqatech/node-apn-http2.git"},"contributors":[{"name":"AlqaTech Team","email":"info@alqatech.com","url":"https://github.com/alqatech"},{"name":"Andrei Alecu","url":"https://github.com/andreialecu"},{"name":"Peter Verhage","email":"peter@egeniq.com","url":"https://github.com/petercv"}],"author":{"name":"AlqaTech","email":"info@alqatech.com","url":"https://github.com/alqatech"},"bugs":{"url":"https://github.com/alqatech/node-apn-http2/issues"},"license":"MIT","readme":"@alqatech/node-apn-http2\n==============\n\n[![Current Version](https://img.shields.io/npm/v/@vlasky/node-apn-http2.svg?style=flat-square)](https://www.npmjs.org/package/@vlasky/node-apn-http2)\n\n> A Node.js module for interfacing with the Apple Push Notification service using *NATIVE* node.js http2 API (requires node v10+)\n\nThis package is supposed to be drop-in compatible with [node-apn](https://github.com/node-apn/node-apn), however, only token based credentials are supported (p8).\n\n### Installation\n\n[yarn](https://yarnpkg.com) is the preferred installation method:\n\n```bash\n$ yarn add @alqatech/node-apn-http2\n```\n\n### Load in the module\n\n```javascript\nvar apn = require('@alqatech/node-apn-http2');\n```\n\n```javascript\nvar options = {\n  token: {\n    key: \"path/to/APNsAuthKey_XXXXXXXXXX.p8\",\n    keyId: \"key-id\",\n    teamId: \"developer-team-id\"\n  },\n  production: false,\n  pingInterval: 500000, // Change Ping time according to your environment \n                        // Apple may stop responding if Ping interval is too high \n  hideExperimentalHttp2Warning: true // the http2 module in node is experimental and will log \n                                     // ExperimentalWarning: The http2 module is an experimental API. \n                                     // to the console unless this is set to true\n};\n\nvar apnProvider = new apn.Provider(options);\n```\n\nBy default, the provider will connect to the sandbox unless the environment variable `NODE_ENV=production` is set.\n\n### Sending a notification\nTo send a notification you will first need a device token from your app as a string\n\n```javascript\nlet deviceToken = \"a9d0ed10e9cfd022a61cb08753f49c5a0b0dfb383697bf9f9d750a1003da19c7\"\n```\n\n```javascript\nvar note = new apn.Notification();\n\nnote.expiry = Math.floor(Date.now() / 1000) + 3600; // Expires 1 hour from now.\nnote.badge = 3;\nnote.sound = \"ping.aiff\";\nnote.alert = \"\\uD83D\\uDCE7 \\u2709 You have a new message\";\nnote.payload = {'messageFrom': 'John Appleseed'};\nnote.topic = \"<your-app-bundle-id>\";\n```\n\nSend the notification to the API with `send`, which returns a promise.\n\n```javascript\napnProvider.send(note, deviceToken).then( (result) => {\n  // see documentation for an explanation of result\n});\n```\n\nThis will result in the the following notification payload being sent to the device\n\n```json\n{\"messageFrom\":\"John Appleseed\",\"aps\":{\"badge\":3,\"sound\":\"ping.aiff\",\"alert\":\"\\uD83D\\uDCE7 \\u2709 You have a new message\"}}\n```\n\nYou should only create one `Provider` per-process for each certificate/key pair you have. You do not need to create a new `Provider` for each notification. If you are only sending notifications to one app then there is no need for more than one `Provider`. \n\nIf you are constantly creating `Provider` instances in your app, make sure to call `Provider.shutdown()` when you are done with each provider to release its resources and memory. \n\n## Troubleshooting\n\nYou are encouraged to read the extremely informative [Troubleshooting Push Notifications](http://developer.apple.com/library/ios/#technotes/tn2265/_index.html) Tech Note in the first instance, in case your query is answered there.\n\n## History\n\n### v1.2.3\n\n- Ping Interval time is now configurable to avoid connection lost \n\n### v1.2.2\n\n- Updated dependencies jsonwebtoken to version 8.5.1 and typescript to version 4.2.4\n\n### v1.2.1\n\nPeter Verhage's enhancements:\n\n- Sends an HTTP/2 ping to the APN gateway every 10 minutes to ensure the active session is still open. If not, it will attempt to reconnect.\n- Ensures that we are connected before creating requests. This avoids creating excessive listeners.\n\nVlad Lasky's enhancements:\n\n- Added support for the `apns-push-type` attribute, now required for iOS 13.\n- The `apns-priority` attribute value is now correctly set.\n\n### v1.2.0\n\n- return potential error response body as object instead of string (fixes #4) \n\n### v1.1.0\n\n- add option to hide \"ExperimentalWarning: The http2 module is an experimental API.\" message\n\n### v1.0.1\n\n- fix base64 encoded p8 token string not being correctly identified as a string\n\n### v1.0.0\n\n- returned promise from `.send()` is now compatible with the one that `node-apn` normally returned\n","readmeFilename":"README.md"}