@@ -25,6 +25,7 @@ npm install node-pushnotifications
2525* iOS:* Prepare cert.pem and key.pem as described in [ node-apn] ( https://github.com/argon/node-apn/wiki/Preparing-Certificates )
2626
2727Import and setup push module:
28+
2829``` js
2930var settings = {
3031 gcm: {
@@ -68,8 +69,11 @@ GCM and ADM options: see [node-gcm](https://github.com/ToothlessGear/node-gcm#cu
6869
6970APN options: see [ node-apn] ( https://github.com/argon/node-apn/blob/master/doc/connection.markdown )
7071
72+ MPNS options see [ mpns] ( https://github.com/jeffwilcox/mpns )
73+
7174
7275Define destination device ID. You can send to multiple devices, independently of platform, creating an array with different destination device IDs.
76+
7377``` js
7478// Single destination
7579var deviceIds = ' INSERT_YOUR_DEVICE_ID' ;
@@ -80,18 +84,25 @@ deviceIds.push('INSERT_YOUR_DEVICE_ID');
8084deviceIds .push (' INSERT_OTHER_DEVICE_ID' );
8185```
8286
83- Next, create a JSON object witch MUST contain, at least, a title and message and send it to server.
87+ Next, create a JSON object witch MUST contain, at least, a title and message and send it to server.
88+
8489``` js
8590var data = {
8691 title: ' New push notification' ,
8792 message: ' Powered by AppFeel' ,
8893 otherfields: ' optionally add more data'
8994};
90- push .send (deviceIds, data, function (result ) {
91- console .log (result);
95+ push .send (deviceIds, data, function (err , result ) {
96+ if (err) {
97+ console .log (err);
98+ } else {
99+ console .log (result);
100+ }
92101});
93102```
94- Result will contain 'true' or 'an error description'.
103+
104+ Error will be null if all went fine, will return the error otherwise.
105+ Result will contain 'true' if all went fine.
95106
96107
97108##Resources
0 commit comments