muck around with WS URI

This commit is contained in:
Jan-Piet Mens
2015-09-09 15:48:30 +02:00
parent 33255627df
commit fba28a2ff0
3 changed files with 11 additions and 3 deletions

View File

@@ -52,6 +52,7 @@ function map_marker(loc)
if (loc.addr && loc.topic) {
d = loc.topic + " " + loc.addr;
d = "<b>" + loc.topic.split('/')[2] + "</b><br />" + loc.addr;
} else {
d = 'unknown';
}

View File

@@ -21,7 +21,7 @@
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&signed_in=true"></script>
<script src="functions.js"></script>
<script src="ws.js"></script>
<script src="websock.js"></script>
</head>
<body>
<div id="output"></div>

View File

@@ -55,9 +55,16 @@ function ws_connect() {
}
window.onload = function() {
var url = 'ws://' + location.host + '/ws/last';
// var url = 'ws://' + location.host + '/ws/last';
// console.log(JSON.stringify(location));
console.log(JSON.stringify(location));
var url = "ws://" + location.host + "/";
var parts = location.pathname.split('/');
for (var i = 1; i < parts.length - 2; i++) {
url = url + parts[i] + "/";
}
url = url + "ws";
console.log("Websocket URI: " + url);
ws_url = url;
ws_connect();