title: Using a Flash socket with Node.js
body: <p>I've been using <a href="http://github.com/gimite/web-socket-js" rel="noreferrer">gimite / web-socket-js</a> to implement a WebSocket past simply Chrome and development builds of Safari. I want to move away from the Ruby server and onto Node.js. Suddenly it doesn't work in anything but Chrome. </p>
  
  <p>I suspect that this has to do with the <a href="http://www.lightsphere.com/dev/articles/flash_socket_policy.html" rel="noreferrer">Flash Socket Policy</a> file that I need to implement. I would like to implement this as an external Node.js process so as not to muddy with the original application. I am using the <a href="http://github.com/miksago/node-websocket-server" rel="noreferrer">node-websocket-server</a> for implementing WebSocket protocol with Node.js, and again I would prefer to <em>not</em> mess with that either. </p>
  
  <p>It seemed like the simplest thing to do would be to run <a href="http://github.com/LearnBoost/Socket.IO-node/blob/master/lib/socket.io/transports/flashsocket.js" rel="noreferrer">flashsocket.js</a>, but running that gives me the following error:</p>
  
  <pre><code>sys:334
      ctor.prototype = Object.create(superCtor.prototype, {
                              ^
  TypeError: Object prototype may only be an Object or null
      at Function.create (native)
      at Object.inherits (sys:334:29)
      at Object.&lt;anonymous&gt; (/Users/me/Projects/testing/websocket/node-websocket-server/flashsocket.js:10:16)
      at Module._compile (node.js:472:23)
      at Module._loadScriptSync (node.js:479:10)
      at Module.loadSync (node.js:349:12)
      at Object.runMain (node.js:532:24)
      at node.js:762:10
  </code></pre>
  
  <p>Here we run into the lovely cryptic errors Node.js is loved for. </p>
  
  <p>My question is is there a stand alone global flash socket policy server I can run off of either Node.js or another application? My understanding is that I only need to have it reside on port 843. Or is there another WebSocket library for Node.js that will handle the Flash Policy like the Ruby server does? </p>