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
Not sure if this is the 'correct' way to fix the issue, but it worked for me. (You'll need to have brew)
brew uninstall node
brew install nvm
export NVM_DIR=~/.nvm
source $(brew --prefix nvm)/nvm.sh
nvm install iojs
Update: The behavior described below may have changed since this answer was originally written; as of 0.12.3
, the docs suggest that you can now switch back and forth between paused (new) and flowing (old) mode, and that streams start out in paused mode.
Also, "old" mistakenly suggests a deprecated way of doing things, but while the flowing mode came first, both are supported and have their uses.
I don't have a specific answer, but a general explanation:
The short of it: old code that calls .resume()
or .pause()
on readable streams can break on node 0.10
and higher.
The long of it:
You see this error on node 0.10
or higher when a readable stream has been initialized to use the new, paused mode (based on the readable
event) and an attempt is later made to switch to the old, flowing mode (based on the data
event), which is implicitly attempted when you call .resume()
or .pause()
- see the docs.
Setting up a readable
event may not even be directly involved.
For instance, it seems that using the .pipe()
method now implicitly switches to the new, paused mode, so a subsequent .resume()
call would trigger this error.