I am trying to implement Node.JS apn module to connect to APNS (Apple Push Notification service) to push notification to iPhone devices from the Node server (using ExpressJS) hosted on Amazon EC2 instance running Ubuntu 12.04. I am getting this error:
"Error: Cannot switch to old mode now.",
" at emitDataEvents (_stream_readable.js:720:11)",
" at ReadStream.Readable.resume (_stream_readable.js:705:3)",
" at TLSSocket.<anonymous> (/home/ubuntu/usemebeta/routes/message.js:101:48)",
" at TLSSocket.g (events.js:186:14)",
" at TLSSocket.EventEmitter.emit (events.js:97:17)",
" at TLSSocket.<anonymous> (_tls_wrap.js:579:16)",
" at TLSSocket.EventEmitter.emit (events.js:97:17)",
" at TLSSocket._finishInit (_tls_wrap.js:198:8)"
when I call the apn module function to push notification. However when I do the same thing in a function written in a file and execute that file, then it works just fine. Please help. How should I go about fixing the problem?