Skip to content

Instantly share code, notes, and snippets.

@a-bx
Created September 3, 2012 19:01
Show Gist options
  • Select an option

  • Save a-bx/3612393 to your computer and use it in GitHub Desktop.

Select an option

Save a-bx/3612393 to your computer and use it in GitHub Desktop.
APNS - Create Conncectino
var apns = require('apn');
var options = {
cert: __dirname + '/../config/keys/aps_cert_' + env + '.pem',
certData: null,
key: __dirname + '/../config/keys/aps_key_' + env + '.pem',
keyData: null,
gateway: env == 'production' ? 'gateway.sandbox.push.apple.com' : 'gateway.sandbox.push.apple.com',
port: 2195,
enhanced: true,
errorCallback: function(errorCode, note){
util.debug('ERROR APNS ' + errorCode + " : " + note);
},
cacheLength: 5
};
var apnsConnection = new apns.Connection(options);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment