fixed serverTime
This commit is contained in:
parent
6c2df3f59c
commit
80dc078839
2
app.js
2
app.js
@ -345,7 +345,7 @@ client.on('connection', function (clientSpark)
|
|||||||
clientSpark.on('client-pong', function (data)
|
clientSpark.on('client-pong', function (data)
|
||||||
{
|
{
|
||||||
var serverTime = _.get(data, "serverTime", 0);
|
var serverTime = _.get(data, "serverTime", 0);
|
||||||
var latency = Math.ceil( (_.now() - data.serverTime) / 2 );
|
var latency = Math.ceil( (_.now() - serverTime) / 2 );
|
||||||
|
|
||||||
clientSpark.emit('client-latency', { latency: latency });
|
clientSpark.emit('client-latency', { latency: latency });
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user