node.js - can I use apnagent to send push notifications with only a PEM and passphrase? -


can connect apnagent using single .pem , passphrase? or need separate key .pem too?

i'm little ignorant of different cert files , uses not sure if mistake trying use .pem file , passphrase or if making other mistake.

when run following code, no error or successful response. "waiting events...."

'use strict' const apnagent = require('apnagent') const join = require('path').join const certfile = join(__dirname,'/../certs/mint-apn-dev.pem') const devicetoken = '<token>' const passphrase = '<passphrase>'  let agent = module.exports = new apnagent.agent() agent     .set('cert file',certfile)     .set('passphrase',passphrase)     .enable('sandbox')  agent.connect(function (err) {      if (err && err.name === 'gatewayauthorizationerror') {         console.log('authentication error: %s', err.message)         process.exit(1)     }       else if (err) {         throw err     }       var env = agent.enabled('sandbox')         ? 'sandbox'         : 'production'      console.log('apnagent [%s] gateway connected', env) })  // keep running bit give time succeed or fail let id = setinterval(function() {     console.log('waiting events...')     count++     if (count > 18) clearinterval(id) }, 5000) 

nevermind. answered own question after more testing. .pem file, have have both key , cert. .p12 file, can have 1 file


Comments