Ask, don't tell, or something like that!
Now the WebSocketServer decides what port it will use and everything
else relies on that. By default an ephemeral port is used, but a fixed
port number can be passed in too.
This work is necessary to support Windows (#240) because on Windows a
TCP socket cannot be closed and immediately reopened, which we are doing
in the tests. So this change means that when restarting, a new ephemeral
port can be used by the server.
Using EventMachine was causing issues when run alongside Thin.
In general running the event loop is quite slow, presumably because it
is mostly spinning idly wasting cycles (unsure). We were mitigating
this by stopping the thread when it wasn't needed, but this is
incorrect when Thin is also running.
Implemented WebSocket server using raw TCP sockets and a WebSocket
parser provided by faye-websocket. This is faster and neater and removes
the need to dick around with threads.
Fixes#6.