Posts

Showing posts with the label gcm

Send Push Notification using Node Js

send push notifications to their corresponding iOS and Android devices using the  apn  and  node-gcm-service  node modules. apn = require ( 'apn' ) ; gcm = require ( 'node-gcm-service' ) ; For ios, assuming we have our cert.pem and key.pem files generated from the APNS certificate at root level in our project folder, use  device ID  to create our apn connection instance. function IosPush ( device id , message ) { var apnConnection = new apn . Connection ({ production : false }); var apnDevice = new apn . Device ( device id ); var apnNotification = new apn . Notification (); apnNotification . alert = message ; apnNotification . badge = 0; apnNotification . contentAvailable = true ; apnNotification . sound = "ping.aiff" ; apnNotification . pushNotification ( apnNotification , apnDevice ); } Above we set the message that the user will see when r