1
0
mirror of https://github.com/dani/vroom.git synced 2024-06-26 17:43:29 +02:00

Ping only after joining the room

Fix #98
This commit is contained in:
Daniel Berteaud 2015-03-11 11:53:26 +01:00
parent 0d0b6afbf1
commit 7c42333af4

View File

@ -1463,6 +1463,31 @@ function initVroom(room) {
});
}
}, 10000);
// Ping the room every minutes
// Used to detect inactive rooms
setInterval(function(){
$.ajax({
data: {
req: JSON.stringify({
action: 'ping',
param: {
room: roomName
}
})
},
error: function(data) {
showApiError(data);
},
success: function(data) {
if (data.msg && data.msg != ''){
$.notify(data.msg, {
className: 'info',
autoHide: false
});
}
}
});
}, 60000);
}
// Notify the server a new participant has joined (ourself)
// If we were prompted for our display name before joining
@ -1943,32 +1968,6 @@ function initVroom(room) {
});
}
// Ping the room every minutes
// Used to detect inactive rooms
setInterval(function(){
$.ajax({
data: {
req: JSON.stringify({
action: 'ping',
param: {
room: roomName
}
})
},
error: function(data) {
showApiError(data);
},
success: function(data) {
if (data.msg && data.msg != ''){
$.notify(data.msg, {
className: 'info',
autoHide: false
});
}
}
});
}, 60000);
// Ping all the peers every 5 sec to measure latency
// Do this through dataChannel
setInterval(function(){