Automattic/socket.io-client — pull request #783 by davidbau (2014-11-12 04:58:29+00:00)
Title: accept relative paths and Location objects for io.connect(url)

Relative path support is added, to allow JS to be written that can be moved to different locations and different namespaces without changing the code. Allows socket.io namespaces to be arranged the same way URLs are arranged.

Also, this change avoids changing the passed option objects in-place, so window.location can be passed as a URL.

Examples of what is fixed: location.href is 'http://myhost.com/mydir/myfile'
Then:
io.connect('.') is equivalent to io.connect('http://myhost.com/mydir/')
io.connect('..') is equivalent to io.connect('http://myhost.com/')
io.connect('./endpoint') is equivalent to io.connect('http://myhost.com/mydir/endpoint')
io.connect(location) is equivalent to io.connect('http://myhost.com/mydir/myfile')