You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Parts of this software are copyright (c) 2010 Andrew Naylor.
2
+
Parts of this software are copyright (c) Parse Platform.
3
+
All rights reserved.
2
4
3
-
Permission is hereby granted, free of charge, to any person obtaining a copy
4
-
of this software and associated documentation files (the "Software"), to deal
5
-
in the Software without restriction, including without limitation the rights
6
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
-
copies of the Software, and to permit persons to whom the Software is
8
-
furnished to do so, subject to the following conditions:
5
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
6
+
furnished to do so, subject to the following conditions:
9
7
10
-
The above copyright notice and this permission notice shall be included in
11
-
all copies or substantial portions of the Software.
8
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12
9
13
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
-
THE SOFTWARE.
10
+
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.
A Node.js module for interfacing with the Apple Push Notification service.
18
13
19
-
## Features
14
+
---
20
15
21
-
- Based on HTTP/2 based provider API
22
-
- Maintains a connection to the server to maximise notification batching and throughput.
23
-
- Automatically resends unsent notifications if an error occurs
16
+
-[Features](#features)
17
+
-[Installation](#installation)
18
+
-[Quick Start](#quick-start)
19
+
-[Load in the module](#load-in-the-module)
20
+
-[Connecting](#connecting)
21
+
-[Connecting through an HTTP proxy](#connecting-through-an-http-proxy)
22
+
-[Using a pool of http/2 connections](#using-a-pool-of-http2-connections)
23
+
-[Sending a notification](#sending-a-notification)
24
+
25
+
# Features
24
26
25
-
## Installation
27
+
- Based on HTTP/2 based provider API
28
+
- Maintains a connection to the server to maximize notification batching and throughput.
29
+
- Automatically re-sends unsent notifications if an error occurs
26
30
27
-
[npm][] is the preferred installation method:
31
+
# Installation
28
32
29
33
```bash
30
34
$ npm install @parse/node-apn --save
31
35
```
32
36
33
-
##Quick Start
37
+
# Quick Start
34
38
35
39
This readme is a brief introduction, please refer to the full [documentation](doc/apn.markdown) in `doc/` for more details.
36
40
37
41
If you have previously used v1.x and wish to learn more about what's changed in v2.0, please see [What's New](doc/whats-new.markdown)
38
42
39
-
###Load in the module
43
+
## Load in the module
40
44
41
45
```javascript
42
46
var apn =require('@parse/node-apn');
43
47
```
44
48
45
-
###Connecting
49
+
## Connecting
46
50
Create a new connection to the Apple Push Notification provider API, passing a dictionary of options to the constructor. You must supply your token credentials in the options.
47
51
48
52
```javascript
@@ -64,7 +68,7 @@ For more information about configuration options consult the [provider documenta
64
68
65
69
Help with preparing the key and certificate files for connection can be found in the [wiki][certificateWiki]
66
70
67
-
####Connecting through an HTTP proxy
71
+
### Connecting through an HTTP proxy
68
72
69
73
If you need to connect through an HTTP proxy, you simply need to provide the `proxy: {host, port}` option when creating the provider. For example:
70
74
@@ -87,7 +91,7 @@ var apnProvider = new apn.Provider(options);
87
91
88
92
The provider will first send an HTTP CONNECT request to the specified proxy in order to establish an HTTP tunnel. Once established, it will create a new secure connection to the Apple Push Notification provider API through the tunnel.
89
93
90
-
####Using a pool of http/2 connections
94
+
### Using a pool of http/2 connections
91
95
92
96
Because http/2 already uses multiplexing, you probably don't need to use more than one client unless you are hitting http/2 concurrent request limits.
93
97
@@ -110,7 +114,7 @@ var options = {
110
114
var apnProvider =newapn.MultiProvider(options);
111
115
```
112
116
113
-
###Sending a notification
117
+
## Sending a notification
114
118
To send a notification you will first need a device token from your app as a string
115
119
116
120
```javascript
@@ -147,66 +151,3 @@ This will result in the the following notification payload being sent to the dev
147
151
You 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`.
148
152
149
153
If 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.
150
-
151
-
## Troubleshooting
152
-
153
-
You are encouraged to read the extremely informative [Troubleshooting Push Notifications][tn2265] Tech Note in the first instance, in case your query is answered there.
154
-
155
-
## Support
156
-
157
-
If you have any questions or difficulties working with the module, the [node-apn Google group][googlegroup] should be your first port of call.
158
-
159
-
Please 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.
160
-
161
-
## Resources
162
-
163
-
*[Local and Push Notification Programming Guide: APNs Overview][pl]
> copies of the Software, and to permit persons to whom the Software is
184
-
> furnished to do so, subject to the following conditions:
185
-
>
186
-
> The above copyright notice and this permission notice shall be included in
187
-
> all copies or substantial portions of the Software.
188
-
>
189
-
> 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.
[googlegroup]:https://groups.google.com/group/node-apn"node-apn Google Group"
197
-
[pacapn]:https://github.com/node-apn/node-apn/wiki/Projects,-Applications,-and-Companies-Using-Node-apn"List of Projects, Applications and Companies Using node-apn"
0 commit comments