From 76b80a3ddbf19e79b3aff22e7bbcdad28183f10d Mon Sep 17 00:00:00 2001 From: cubedro Date: Mon, 6 Apr 2015 04:51:19 +0300 Subject: [PATCH] fixed latency --- lib/node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/node.js b/lib/node.js index e93a84e..83c676a 100644 --- a/lib/node.js +++ b/lib/node.js @@ -112,7 +112,7 @@ function Node() console.warn('We are scheduling a reconnect operation', opts); }) .on('node-pong', function(data) { - var latency = (new Date()).getTime() - self._latency; + var latency = Math.ceil(((new Date()).getTime() - self._latency)/2); socket.emit('latency', { id: self.id, latency: latency }); }) .on('data', function incoming(data) {