a whole bunch of things
This commit is contained in:
+12
-5
@@ -8,11 +8,18 @@ export const methods = {
|
||||
{
|
||||
"action": "PONG",
|
||||
}
|
||||
*/
|
||||
action_PONG(action, payload){
|
||||
clearTimeout(this.keepAliveBomb);
|
||||
this.keepAliveNextTimeout = setTimeout(this.keepAlive.bind(this),this.config.server.keepAliveInterval*1000);
|
||||
},
|
||||
*/
|
||||
action_PONG(action, payload, reqid){
|
||||
|
||||
if(reqid == this.latestPing.id) {
|
||||
console.log('====>PONG', reqid, this.latestPing, Date.now() - this.latestPing.time)
|
||||
this.roundTripTime = (this.roundTripTime + (Date.now() - this.latestPing.time)) / 2 //Exponential smoothing
|
||||
}
|
||||
// First defuse the bomb
|
||||
clearTimeout(this.keepAliveBomb)
|
||||
// Then setup the next one ;-)
|
||||
this.keepAliveNextTimeout = setTimeout(this.keepAlive.bind(this),this.config.server.keepAliveInterval*1000);
|
||||
},
|
||||
|
||||
|
||||
/* Request:
|
||||
|
||||
Reference in New Issue
Block a user