Make socket.io work with subfolder hosting

This is the only thing preventing hosting with a reverse
proxy, like Nginx, on a subfolder. Socket.io insists on
extracting the domain and connecting to it directly.
For example, if hosted at
 http://example.com/subfolder/debug?port=5858
socket.io connects to
 http://example.com/socket.io/..
This commit fixes that, as recommended by socket.io.

Aside: their wiki is outdated/incorrect. The logic is gleaned directly
from the source code of socket.io used with node-inspector.