logicalparadox / apnagent

Node.js adapter for Apple Push Notification (APN) Service.
http://logicalparadox.github.io/apnagent
216 stars 38 forks source link

node agent/_header.js #28

Open davidoresic opened 9 years ago

davidoresic commented 9 years ago

Hi

I have a problem whit _header.js.

I have build an push server that works nice on my local developer env. But once I try to run it on server in DMZ ports opened are (2195,2196,80) if I run node agent/_header.js it doesn't connect and I dont get any error as well ?

this is from console on my Developer PC D:\lpns>node agent/_header.js apnagent [sandbox] gateway connected

if I do it the same way on the server I get nothing :(

PS C:\lpns\lpns> node agent/_header.js PS C:\lpns\lpns>

What can be a issue ?

davidoresic commented 9 years ago

this is the header.js content

// location of app certificate var join = require('path').join, pfx = join(__dirname, '../_certs/pfx.p12'); var config = require('../Config/configuration'); var apnagent = require('apnagent'), agent = module.exports = new apnagent.Agent();

agent.set('pfx file', pfx); agent.set(config.CertUserName, config.CertPassword); agent.enable('sandbox');

agent.connect(function (err) { // gracefully handle auth problems if (err && err.name === 'GatewayAuthorizationError') { console.log('Authentication Error: %s', err.message); process.exit(1); } else if (err) { console.log(err.message); }

// it worked!
var env = agent.enabled('sandbox')
  ? 'sandbox'
  : 'production';

console.log('apnagent [%s] gateway connected', env);

});