Fix port mismatch when used behind a reverse proxy

Websockets port is always the same as the static web server port so
instead of having some tricks, this patch simply removes that and uses
`document.location.protocol` for the port.
Merge pull request #286 from BYK/master

Fix port mismatch when used behind a reverse proxy