This whole block of code building the URL can be greatly simplified:

```js
function resolveRelativeUrl = function(url) {
  var a = document.createElement('a');
  a.href = url;
  return a.href;
}

WebInspector.socket = io.connect(resolveRelativeUrl('socket.io'));
```

(See http://stackoverflow.com/q/470832/69868)