Nice! I love Node for these kind of asynchronous handling of data, it fits perfectly. Keep in mind you can go down the stream route. Instead of:
ps.stdout.on 'data', (data) -> ws.send data.toString()
ws.on 'message', (data) -> ps.stdin.write data.toString()
Just do: ps.stdout.pipe ws
ws.pipe ps.stdin
I started using Node before Streams and I often forget piping too!I still have a question for Node.js experts... would the 'close' events had to be handled then? Streams handle and propagate the 'end' event just fine, but should the underlying resource be closed? I guess killing `ps` is mandatory since ending `stdout` won't kill the process (or will it?), but is closing `ws` still mandatory too?