Handling Timers For Many Users In Nodejs
I'm building a web app in Node/Express such that users can set a timer so that a certain task gets executed or repeated. My question is how can I set timer for many users with an e
Solution 1:
Your web app would have a more responsive UI and your backend would scale better if each client held its own timer. Closing the browser wouldn't be a problem.
- Persist the
endtime
in a DB in your server for the specific question. - On the client side, retrieve the
endtime
from the server, and use JavaScript to create a timer that would alert the user their time has expired. - On the server side, have an additional check that rejects answers if the answer is being submitted past
endtime
to prevent clients from cheating.
Post a Comment for "Handling Timers For Many Users In Nodejs"