title: Node.js node-apn module for Apple Push Notification stopped working after moving to Amazon EC2 instance running Ubuntu 12.04
body: <p>I am using node-apn module to avail of APNS (Apple Push Notification Service) to push notification to multiple devices. The local environment is Mac OS X Lion 10.7 and the code works perfectly fine when run at local server.Here's the snippet:</p>
  
  <pre><code>var apns = require('apn');
  
  var options = {
      cert: __dirname + '/PushDevCertKey.pem',                       
      certData: null,                                
      key:  __dirname + '/PushDevCertKey.pem',                       
      keyData: null,                                 
      passphrase: 'admin',                              
      ca: null,                                      
      pfx: null,                                     
      pfxData: null,                                 
      gateway: 'gateway.sandbox.push.apple.com',     
      port: 2195,                                    
      rejectUnauthorized: true,                      
      enhanced: true,                                
      errorCallback: apnErrorCallback,                      
      cacheLength: 100,                              
      autoAdjustCache: true,                         
      connectionTimeout: 0
  }
  
  var apnsConnection = new apns.Connection(options);
  var note = new apns.Notification();
  
  note.expiry = Math.floor(Date.now() / 1000) + 3600; 
  note.badge = 1;
  note.sound = 'ping.aiff';
  note.alert = 'you have a new message';
  note.payload = {'rid': roomId}; 
  
  apnsConnection.pushNotification(note, deviceTokenArray);
  
  // i handle these events to confirm the notification gets
  // transmitted to the APN server or find error if any
  
  function log(type) {
      return function() {
          console.log(type, arguments);
      }
  }
  
  apnsConnection.on('error', log('error'));
  apnsConnection.on('transmitted', log('transmitted'));
  apnsConnection.on('timeout', log('timeout'));
  apnsConnection.on('connected', log('connected'));
  apnsConnection.on('disconnected', log('disconnected'));
  apnsConnection.on('socketError', log('socketError'));
  apnsConnection.on('transmissionError', log('transmissionError'));
  apnsConnection.on('cacheTooSmall', log('cacheTooSmall')); 
  </code></pre>
  
  <p>I moved the exact same code to the Amazon EC2 instance running Ubuntu 12.04 and it doesn't work there. None of the events above which I handle gets triggered. I checked certificate and key files and paths by printing out the options and apnsConnection objects and there seems no problem there. I don't know what the issue is. Any help will be greatly appreciated.         </p>