I want to construct a WebSocket URI relative to the page URI at the browser side. Say, in my case convert HTTP URIs like
http://example.com:8000/path https:/
var ws = new WebSocket("ws://" + window.location.host + ":6666"); ws.onopen = function() { ws.send( .. etc