Broadcast player posistion to websocket clients this could be high traffic.

This commit is contained in:
Sascha L. Teichmann
2015-03-09 15:37:57 +01:00
parent 99d4f700be
commit c918b538db
3 changed files with 40 additions and 15 deletions

View File

@ -47,13 +47,18 @@ L.Control.AutoUpdate = L.Control.extend({
if (!(typeof json === "string")) {
return invalidateAll;
}
var tiles;
var msg;
try {
tiles = JSON.parse(json);
msg = JSON.parse(json);
} catch (err) {
return invalidateAll;
}
var tiles = msg.tiles;
if !tiles {
continue;
}
var pyramid = new Array(9);
var last = new Object();
pyramid[8] = last;