Trying fix for dead listeners

This commit is contained in:
Kasper Rynning-Tønnesen
2017-09-08 14:51:47 +02:00
parent 5702b4cf8a
commit 94e041e002
4 changed files with 31 additions and 4 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -151,6 +151,12 @@ $().ready(function(){
}
});
socket.on("self_ping", function() {
if(chan != undefined && chan.toLowerCase() != "") {
socket.emit("self_ping", {channel: chan.toLowerCase()});
}
});
setup_no_connection_listener();
try{

View File

@@ -141,7 +141,6 @@ io.on('connection', function(socket){
var socketid = socket.id;
var coll;
var tot_lists = [];
var in_list = false;
var short_id = uniqueID(socketid,4);
var offline = false;
@@ -157,6 +156,19 @@ io.on('connection', function(socket){
socket.emit("guid", guid);
socket.on('self_ping', function(msg) {
var channel = msg.channel;
if(offline) {
offline_users.push(guid);
} else {
if(lists[channel] == undefined) {
lists[channel] = [];
}
lists[channel].push(guid);
}
tot_view += 1
});
socket.on('chromecast', function(msg) {
try {
if(typeof(msg) == "object" && msg.hasOwnProperty("guid") && msg.hasOwnProperty("socket_id") && msg.hasOwnProperty("channel")) {
@@ -1155,9 +1167,10 @@ io.on('connection', function(socket){
}
});
});
});
send_ping();
function decrypt_string(socket_id, pw){
try {
/*
@@ -1196,6 +1209,14 @@ function decrypt_string(socket_id, pw){
}
}
function send_ping() {
lists = {};
offline_users = [];
tot_view = 0;
io.emit("self_ping");
setTimeout(send_ping, 25000);
}
function left_channel(coll, guid, name, short_id, in_list, socket, change)
{
if(lists[coll] !== undefined && contains(lists[coll], guid))