meteortimermeteor-collectionsmeteor-collection-hooks

Server side timer after meteor collection is updated


I'm currently developping a simple realtime multiplayer game and i'm stuck with the timer logic.

When there are enough players in a game, the status of the game is set to "STARTED" and from there i want to start a 10 seconds timer and show it to all the clients.

My idea is to use collection hooks and call a setTimeout after the collection update. But I don't really know how to do it and if it is the best solution.

Also maybe should I use cron instead of timers?


Solution

  • I would use the following logic :