Will setInterval give me Delay?

Posted by Oliver Schöning on Game Development See other posts from Game Development or by Oliver Schöning
Published on 2012-10-29T08:09:18Z Indexed on 2012/10/29 11:19 UTC
Read the original article Hit count: 222

Filed under:

I am setting up a JavaScript Server for my Game.

Am I understanding this correctly:

If I use setInterval to call a function every second, and takes 2 seconds to process. Then I am going to "stack up" requests indefinetly the Client will become more and more out of sync?

If I use setTimeout, and specify 1 second. Then the function will run (again, lets say 2 seconds) and then start the timeout. And not stack up requests.

© Game Development or respective owner

Related posts about JavaScript