0
apnagentで接続できるのは、単一の.pemとパスフレーズだけですか?または、別のキー.pemも必要ですか?PEMとパスフレーズのみでプッシュ通知を送信するためにapnagentを使用できますか?
私は、自分の間違いが.pemファイルとパスフレーズのみを使用しようとしているのか、他の間違いをしているのか分かりません。
次のコードを実行すると、エラーまたは正常な応答は得られません。私の "イベントを待っています...."
'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 it running for a bit to give it time to succeed or fail
let id = setInterval(function() {
console.log('Waiting for events...')
count++
if (count > 18) clearInterval(id)
}, 5000)
明らかに、私は接続しようとしていますが、メッセージは送信しません。 – bluefoxcode