fixed latency

This commit is contained in:
cubedro 2015-04-06 04:51:19 +03:00
parent 111b4a1bb0
commit 76b80a3ddb

View File

@ -112,7 +112,7 @@ function Node()
console.warn('We are scheduling a reconnect operation', opts); console.warn('We are scheduling a reconnect operation', opts);
}) })
.on('node-pong', function(data) { .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 }); socket.emit('latency', { id: self.id, latency: latency });
}) })
.on('data', function incoming(data) { .on('data', function incoming(data) {