-
Notifications
You must be signed in to change notification settings - Fork 1
/
params.json
6 lines (6 loc) · 9.27 KB
/
params.json
1
2
3
4
5
6
{
"name": "node-apn",
"tagline": "A Node.js module for interfacing with the Apple Push Notification service",
"body": "[![NPM][npm-image] ][npm-url]\r\n\r\n[![Build status][ci-image] ][ci-url]\r\n[![Code coverage][coverage-image]][coverage-url]\r\n[![Codacy][codacy-image]][codacy-url]\r\n\r\n[![dependencies][dependencies-image]][dependencies-url]\r\n[![devdependencies][devdependencies-image]][devdependencies-url]\r\n\r\n[![Issue Stats][issuestats-pr-image]][issuestats-url]\r\n[![Issue Stats][issuestats-image]][issuestats-url]\r\n\r\n[npm-image]:https://nodei.co/npm/apn.png?downloads=true\r\n[npm-url]:https://npmjs.com/package/apn\r\n[ci-image]:https://travis-ci.org/argon/node-apn.png?branch=master\r\n[ci-url]:https://travis-ci.org/argon/node-apn\r\n[coverage-image]:https://coveralls.io/repos/argon/node-apn/badge.svg?branch=master\r\n[coverage-url]:https://coveralls.io/r/argon/node-apn\r\n[codacy-image]:https://www.codacy.com/project/badge/e7735fbe0db244f3b310657d0dabaa11\r\n[codacy-url]:https://www.codacy.com/public/argon/node-apn\r\n\r\n[dependencies-image]:https://david-dm.org/argon/node-apn.png\r\n[dependencies-url]:https://david-dm.org/argon/node-apn\r\n[devdependencies-image]:https://david-dm.org/argon/node-apn/dev-status.png\r\n[devdependencies-url]:https://david-dm.org/argon/node-apn#info=devDependencies\r\n\r\n[issuestats-image]:http://issuestats.com/github/argon/node-apn/badge/issue\r\n[issuestats-pr-image]:http://issuestats.com/github/argon/node-apn/badge/pr\r\n[issuestats-url]:http://issuestats.com/github/argon/node-apn\r\n\r\n## Features\r\n\r\n- Fast\r\n- Maintains a connection to the server to maximise notification batching and throughput.\r\n- Enhanced binary interface support, with error handling\r\n- Automatically sends unsent notifications if an error occurs\r\n- Feedback service support\r\n- Complies with all best practises laid out by Apple\r\n\r\n## Installation\r\n\r\nVia [npm][]:\r\n\r\n\t$ npm install apn\r\n\t\r\nAs a submodule of your project (you will also need to install [q][q])\r\n\r\n\t$ git submodule add http://github.com/argon/node-apn.git apn\r\n\t$ git submodule update --init\r\n\r\n## Quick Start\r\n\r\nThis is intended as a brief introduction, please refer to the documentation in `doc/` for more details.\r\n\r\n### Load in the module\r\n\r\n\tvar apn = require('apn');\r\n\r\n### Connecting\r\nCreate a new connection to the APN gateway server, passing a dictionary of options to the constructor. If you name your certificate and key files appropriately (`cert.pem` and `key.pem`) then the defaults should be suitable to get you up and running.\r\n\r\n```javascript\r\n\tvar options = { };\r\n\r\n\tvar apnConnection = new apn.Connection(options);\r\n```\r\n\r\nBy default, if the environment variable `NODE_ENV=production` is set, the module will connect to the production gateway. Otherwise it will connect to the sandbox. This along with many other settings can be overriden with the options object.\r\n\r\nFor more information about configuration options consult the [documentation](doc/connection.markdown).\r\n\r\nHelp with preparing the key and certificate files for connection can be found in the [wiki][certificateWiki]\r\n\r\n### Sending a notification\r\nTo send a notification first create a `Device` object. Pass it the device token as either a hexadecimal string, or alternatively as a `Buffer` object containing the token in binary form.\r\n\r\n\tvar myDevice = new apn.Device(token);\r\n\r\nNext, create a notification object, set the relevant parameters (See the [payload documentation][pl] for more details.) and use the `pushNotification` method on the connection to send it.\r\n\r\n\tvar note = new apn.Notification();\r\n\t\r\n\tnote.expiry = Math.floor(Date.now() / 1000) + 3600; // Expires 1 hour from now.\r\n\tnote.badge = 3;\r\n\tnote.sound = \"ping.aiff\";\r\n\tnote.alert = \"\\uD83D\\uDCE7 \\u2709 You have a new message\";\r\n\tnote.payload = {'messageFrom': 'Caroline'};\r\n\t\r\n\tapnConnection.pushNotification(note, myDevice);\r\n\r\nThe above options will compile the following dictionary to send to the device:\r\n\r\n\t{\"messageFrom\":\"Caroline\",\"aps\":{\"badge\":3,\"sound\":\"ping.aiff\",\"alert\":\"\\uD83D\\uDCE7 \\u2709 You have a new message\"}}\r\n\r\n### Setting up the feedback service\r\n\r\nApple recommends checking the feedback service periodically for a list of devices for which there were failed delivery attempts.\r\n\r\nUsing the `Feedback` object it is possible to periodically query the server for the list. Many of the options are similar to that of `Connection`, including the authentication configuration. It is recomended that you share the same configuration object between Connection and Feedback instances to ensure they stay in sync.\r\n\r\nAttach a listener to the `feedback` event to receive the output as two arguments, the `time` returned by the server (epoch time) and a `Buffer` object containing the device token - this event will be emitted for each device separately. Alternatively you can enable the `batchFeedback` option and the `feedback` event will provide an array of objects containing `time` and `device` properties.\r\n\r\n\tvar options = {\r\n\t\t\"batchFeedback\": true,\r\n\t\t\"interval\": 300\r\n\t};\r\n\r\n\tvar feedback = new apn.Feedback(options);\r\n\tfeedback.on(\"feedback\", function(devices) {\r\n\t\tdevices.forEach(function(item) {\r\n\t\t\t// Do something with item.device and item.time;\r\n\t\t});\r\n\t});\r\n\r\nBy specifying a time interval (in seconds) `Feedback` will periodically query the service without further intervention.\r\n\r\nMore information about the feedback service can be found in the [feedback service documentation][fs].\r\n\r\n## Debugging\r\n\r\nIf you experience difficulties sending notifications or using the feedback service you can enable debug messages within the library by running your application with `DEBUG=apn` or `DEBUG=apnfb` set as an environment variable.\r\n\r\nYou are encouraged to read the extremely informative [Troubleshooting Push Notifications][tn2265] Tech Note in the first instance, in case your query is answered there.\r\n\r\n## Support\r\n\r\nIf you have any questions or difficulties working with the module, the [node-apn Google group][googlegroup] should be your first port of call. \r\n\r\nPlease include as much detail as possible - especially debug logs, if the problem is reproducible sample code is also extremely helpful. GitHub Issues should only be created for verified problems and enhancements, this will allow them to be tracked more easily.\r\n\r\n## Resources\r\n\r\n* [Local and Push Notification Programming Guide: Apple Push Notification Service][pl]\r\n* [Apple Technical Note: Troubleshooting Push Notifications][tn2265]\r\n* [List of Projects, Applications and Companies Using Node-apn][pacapn]\r\n\r\n## Credits\r\n\r\nCreated by [Andrew Naylor][andrewnaylor].\r\n\r\n## License\r\n\r\nReleased under the MIT License\r\n\r\n> Copyright (c) 2016 Andrew Naylor\r\n>\r\n> Permission is hereby granted, free of charge, to any person obtaining a copy\r\n> of this software and associated documentation files (the \"Software\"), to deal\r\n> in the Software without restriction, including without limitation the rights\r\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\r\n> copies of the Software, and to permit persons to whom the Software is\r\n> furnished to do so, subject to the following conditions:\r\n>\r\n> The above copyright notice and this permission notice shall be included in\r\n> all copies or substantial portions of the Software.\r\n>\r\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r\n\r\n[certificateWiki]:https://github.com/argon/node-apn/wiki/Preparing-Certificates \"Preparing Certificates\"\r\n[errors]:https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW4 \"The Binary Interface and Notification Formats\"\r\n[pl]: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/ApplePushService.html#//apple_ref/doc/uid/TP40008194-CH100-SW1 \"Local and Push Notification Programming Guide: Apple Push Notification Service\"\r\n[fs]: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW3 \"The Feedback Service\"\r\n[tn2265]: http://developer.apple.com/library/ios/#technotes/tn2265/_index.html \"Troubleshooting Push Notifications\"\r\n[googlegroup]:https://groups.google.com/group/node-apn \"node-apn Google Group\"\r\n[pacapn]:https://github.com/argon/node-apn/wiki/Projects,-Applications,-and-Companies-Using-Node-apn \"List of Projects, Applications and Companies Using Node-apn\"\r\n[andrewnaylor]: http://andrewnaylor.co.uk\r\n[npm]: https://npmjs.org\r\n",
"note": "Don't delete this file! It's used internally to help with page regeneration."
}