how to add Ping : Measure Time Latency

Post here your questions about the Flash / Flex / Air API for SFS2X

Moderators: Lapo, Bax

Post Reply
Fantasticx
Posts: 17
Joined: 14 Aug 2011, 05:02
Contact:

how to add Ping : Measure Time Latency

Post by Fantasticx »

how to add Ping : Measure Time Latency?
im trying to make a fighting and I wonna know how to add in ping.
jamalsoueidan
Posts: 153
Joined: 15 Aug 2011, 16:33

Post by jamalsoueidan »

You need to calculated yourself :D


Check this post.
http://forums.smartfoxserver.com/viewtopic.php?t=12030
---------------------------------------------------
Jamal Soueidan
http://linkedin.com/in/jamalsoueidan
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post 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
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Fantasticx
Posts: 17
Joined: 14 Aug 2011, 05:02
Contact:

Post 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?
Fantasticx
Posts: 17
Joined: 14 Aug 2011, 05:02
Contact:

Post 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.
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Post 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.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
Post Reply