I'm trying to display the latency on my client, but I can't get it to work properly. I searched on this forum and I found you guys recommend to use the lagmonitor in combination with the PingPong event. However, I can't find this in the iOS API.
Right now I calculate the latency by adding a unix timestamp to my packages sent from the server with:
Code: Select all
System.currentTimeMillis()Code: Select all
// Extract the timestamp from the message
double timestamp = [[dictionary objectForKey:TIMESTAMP_KEY] doubleValue];
// Calculate the latency
NSNumber *systemTimestamp = [NSNumber numberWithDouble:1000.0 * [[NSDate date] timeIntervalSince1970]];
int latency = (int) ([systemTimestamp doubleValue] - timestamp);
Thanks