Mercurial > hg > nodescore
diff www/m/js/nodescore-client.js @ 23:e1a02869da08
reduced to one score file with menu to choose which part stream to receive
added latency results to client and tweeked some css
author | tzara <rc-web@kiben.net> |
---|---|
date | Wed, 11 Jul 2012 14:17:43 +0100 |
parents | bb02a593b7d5 |
children | 22f1c38007ff |
line wrap: on
line diff
--- a/www/m/js/nodescore-client.js Wed Jul 11 09:51:05 2012 +0100 +++ b/www/m/js/nodescore-client.js Wed Jul 11 14:17:43 2012 +0100 @@ -19,7 +19,7 @@ $(".metrocase > div").each(function(){$(this).stop()}); $(".metrocase > div").each(function(){$(this).css('background-color', beatcolor)}); $(".metrocase > div").each(function(){$(this).text(" ")}); - $(".metrocase > div").each(function(){$(this).animate({opacity: 0.5}, + $(".metrocase > div").each(function(){$(this).animate({opacity: 0.6}, 50, function() { $(this).animate({opacity:0.0}); } ); @@ -45,7 +45,7 @@ //if (groupID == groupPage) { socket.on("dateTime", function(datetime) { // console.log(datetime) - $("div#datetime").text("server time: " +datetime); + $("div#datetime").text("Server Time: " +datetime); }); @@ -169,3 +169,22 @@ }); //////////////////////////////////////////////// +// this needs to have a variable to define the websocket +// otherwise we will pings from all sockets connected +// no! the server broadcasts the ping and the clients emit the pong! +// ah but then the time reported back from the server needs to be targeted +// to specific client.. +////////////////////////////////////////////// +// Latency "Pong" + +socket.on("timeFromServer", function(n) { + socket.emit("clientTimeResponse",n); +}); +socket.on("latencyFromServer", function(latency) { + $("#client_latency").text("Latency: "+latency+"ms.") + console.log(latency) +}); + +function getLatencies(x) { socket.emit("getLatencies", x); } + +////////////////////////////////////////////// \ No newline at end of file