Page 1 of 1
how to add Ping : Measure Time Latency
Posted: 29 Aug 2011, 03:44
by Fantasticx
how to add Ping : Measure Time Latency?
im trying to make a fighting and I wonna know how to add in ping.
Posted: 29 Aug 2011, 09:26
by jamalsoueidan
Posted: 29 Aug 2011, 09:52
by rjgtav
Hi, it depends if you want server-side ping measurement or client-side only.
If you want server-side, then yes, you need to make your own custom implementation but, if you want it client-side, you can use the enableLagMonitor method of the
SmartFox class and then listen to the
pingPong event
Posted: 30 Aug 2011, 02:10
by Fantasticx
Yes I dont understand how to use PingPong. I need a quick tutorial on it.
I read the Smartfox docs. still dont understand.
Do I do this? sfs.enableLagMonitor(enabled:true) or sfs.enableLagMonitor(true) or sfs.enableLagMonitor(enabled) .
and how would I set it all up. Any help?
Posted: 30 Aug 2011, 02:21
by Fantasticx
Btw, my goal is to make the timing on both User screen exactly the same.
I need Ping to put Latency on the buttons to make the time both on the user screens.
Posted: 30 Aug 2011, 05:38
by rjgtav
to enable the lag monitor you do sfs.enableLagMonitor(true) and then you listen to the pingPong event by doing sfs.addEventListener(SFSEvent.PING_PONG, pingPongHandler).
To show it to the other user, you could, for example, store the lag value as an UserVariable.