alexscheelmeyer/node-phantom — pull request #30 by reid (2013-01-30 01:05:02+00:00)
Title: Prepare Socket.io before spawning PhantomJS.

Attaches Socket.io immediately to the node-phantom HTTP server,
instead of doing so later in the spawnPhantom callback.

A race condition can occur if PhantomJS is started and visits the
node-phantom control page before Socket.io was setup to serve on
node-phantom's server. If PhantomJS is fast enough, it will attempt
to fetch socket.io.js as a script but instead will recieve the
referring page's HTML as the script, causing PhantomJS to emit
a "Parse error" for the bogus script.