Fixed errors on listening on the remote

This commit is contained in:
Kasper Rynning-Tønnesen
2015-06-26 17:21:45 +02:00
parent 16e5ea0cb9
commit 2a4baa2797
2 changed files with 11 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@@ -1,10 +1,19 @@
var Hostcontroller = { var Hostcontroller = {
host_listener: function() { host_listener: function() {
var old_id;
socket.on("id", function(id) socket.on("id", function(id)
{ {
if(old_id === undefined) old_id = id;
else
{
socket.removeAllListeners(id);
began = false;
old_id = id;
}
var codeURL = "//"+window.location.hostname+"/remote/"+id; var codeURL = "//"+window.location.hostname+"/remote/"+id;
console.log(id);
$("#code-text").text(id) $("#code-text").text(id)
$("#code-qr").attr("src", "https://chart.googleapis.com/chart?chs=221x221&cht=qr&choe=UTF-8&chld=L|1&chl="+codeURL); $("#code-qr").attr("src", "https://chart.googleapis.com/chart?chs=221x221&cht=qr&choe=UTF-8&chld=L|1&chl="+codeURL);
$("#code-link").attr("href", codeURL); $("#code-link").attr("href", codeURL);