Fix javascript to derive the websocket url. Uses gross string-munging on window.location. Reference: /n/atom/patch/applied/websocket-wsurl Date: Mon Feb 17 22:46:05 CET 2014 Signed-off-by: root@davidrhoskin.com --- /usr/web/9wd/js/init.js Mon Feb 17 22:44:08 2014 +++ /usr/web/9wd/js/init.js Mon Feb 17 22:44:10 2014 @@ -21,8 +21,7 @@ var ninep; window.onload = function(){ - //var wsurl = Socket.wsurl(window.location.toString()); - var wsurl = "ws://172.16.0.17/magic/websocket"; + var wsurl = Socket.wsurl(window.location.toString()); var webdraw = elem("webdraw"); basetime = Date.now(); --- /usr/web/9wd/js/lib9p/socket.js Mon Feb 17 22:44:13 2014 +++ /usr/web/9wd/js/lib9p/socket.js Mon Feb 17 22:44:14 2014 @@ -13,5 +13,6 @@ } /* I couldn't find a better way to get a Websocket to the same server. */ Socket.wsurl = function(url){ - return url.replace(/^http/, "ws").concat("9p"); + var host = url.replace(/^.*\/\//, "").split("/", 1)[0]; + return "ws://".concat(host).concat("/magic/websocket"); }