Add socket.io.
Fix 'indexOf' calls.
Merge branch `rewrite` into `master`.