node.js - APN Feedback service does not send tokens -


i implemented node.js script queries apn feedback service retrieve list of invalid tokens. unfortunately, did not manage invalid token. followed these steps:

  1. install ios app push notifications in sandbox mode.
  2. send notifications app (done successfully).
  3. uninstall app (i read if app uninstall 1 push notifications, cause disconnection apn service , make impossible notify app uninstalled; not case, ipad has many push notification apps installed!!).
  4. send many other notifications same token, ten or twenty, prove application token not valid anymore (obviously notifications not delivered because app has been uninstalled).
  5. query feedback service invalid token. feedback service not send anything, closes connection without kind of data.

this script use query feedback service:

function pollapnfeedback() {     var certpem = fs.readfilesync('apns-prod-cert.pem', encoding='ascii');     var keypem = fs.readfilesync('apns-prod-key-noenc.pem', encoding='ascii');     var options = { key: keypem, cert: certpem };      console.log("connecting apn feedback service");      var stream = tls.connect(2196, 'feedback.sandbox.push.apple.com', options, function() {         if (stream.authorized == false) {             return console.log('not connected')         } else {             console.log('connected');         };           var bufferlist = [];         stream.on('data', function(data) {             // apn feedback starts sending data on successful connect             console.log('-->data: ', data);             //bufferlist.push(data);         });          stream.on('readable', function(){             console.log('we have incoming data');         });          stream.on('error', function(err){             console.log('error: ', err);         });          stream.on('close', function(){             console.log('closed');             console.log('stream.data = ', stream.data);         });     }); } 

as can see, put listeners on stream variable. callback function on 'data' listener never invoked, 'close' event triggers callback. sure connection because stream.authorized true. doing wrong?

is possible using production certificate contact sandbox environment?

from code :

var certpem = fs.readfilesync('apns-prod-cert.pem', encoding='ascii');

var keypem = fs.readfilesync('apns-prod-key-noenc.pem', encoding='ascii');

and :

var stream = tls.connect(2196, 'feedback.sandbox.push.apple.com', options, function()

if that's case, that's why doesn't work.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -