Get rid of the ping API call, useless now

master
Daniel Berteaud 10 years ago
parent 003e4ed8a5
commit 761f9035d5
  1. 25
      public/js/vroom.js
  2. 10
      vroom.pl

@ -1644,31 +1644,6 @@ function initVroom(room) {
} }
}, 10000); }, 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
});
}
}
});
}, 120000);
// Notify the server a new participant has joined (ourself) // Notify the server a new participant has joined (ourself)
// If we were prompted for our display name before joining // If we were prompted for our display name before joining
// we send it. Not that I like sending this kind of data to the server // we send it. Not that I like sending this kind of data to the server

@ -202,7 +202,6 @@ helper create_room => sub {
return 0; return 0;
} }
if ($self->get_room_by_name($name)){ if ($self->get_room_by_name($name)){
return 0;
} }
my $sth = eval { my $sth = eval {
$self->db->prepare('INSERT INTO `rooms` $self->db->prepare('INSERT INTO `rooms`
@ -1119,6 +1118,10 @@ websocket '/socket.io/:ver/websocket/:id' => sub {
# Heartbeat reply, update timestamp # Heartbeat reply, update timestamp
elsif ($msg->type eq 'heartbeat'){ elsif ($msg->type eq 'heartbeat'){
$peers->{$id}->{last} = time; $peers->{$id}->{last} = time;
# Update room last activity ~ every 40 heartbeat, so about every 2 minutes
if ((int (rand 200)) <= 5){
$self->update_room_last_activity($peers->{$id}->{room});
}
} }
}); });
@ -1589,11 +1592,6 @@ any '/api' => sub {
status => 503 status => 503
); );
} }
# Handle activity pings sent every minute by each participant
elsif ($req->{action} eq 'ping'){
$self->update_room_last_activity($room->{name});
return $self->render(json => {});
}
# Update room configuration # Update room configuration
elsif ($req->{action} eq 'update_room_conf'){ elsif ($req->{action} eq 'update_room_conf'){
$room->{locked} = ($req->{param}->{locked}) ? '1' : '0'; $room->{locked} = ($req->{param}->{locked}) ? '1' : '0';

Loading…
Cancel
Save