title: node socket io timer implementation
body: <p>I'm creating a drawing/guess game in node &amp; socket.
  Simply said:
  I have a class <strong>Room</strong>, <strong>Game</strong> (which extends Room) and a class <strong>Round</strong> (10 per game).
  Each round a user is assigned as the drawer, the guessers have <em>45 seconds</em> to guess the word.</p>
  
  <p>Upon the first guess if the timer is higher than 20 seconds, the timer is <strong><em>reduced</strong> to 20 seconds</em>.</p>
  
  <p>I'm not certainly sure but this is how I started:</p>
  
  <p><strong>class Round:</strong></p>
  
  <pre><code>function Round(id, game){
    var ROUNDTIME = 45,
        timer = new Date();
    this.id = id;
    this.game = game;
    this.endTime = timer.setSeconds(timer.getSeconds() + ROUNDTIME);
    ...
  }
  </code></pre>
  
  <p><strong>class Game:</strong></p>
  
  <pre><code>function Game(){
    this.MAX_ROUNDS = 10;
    this.rounds = [];
    this.currentRound = null;
    ...
  }
  
  Game.prototype.start = function(){
    this.nextRound;
  }
  
  Game.prototype.nextRound = function(){
    if(this.rounds.length &lt;= this.MAX_ROUNDS){
      this.currentRound = new Round(this.rounds.length + 1, this);
      ...
    } else {
      this.endGame();
    }
  }
  
  Game.prototype.endGame = function(){
    ...
  }
  </code></pre>
  
  <p>Afterwards I have a Round function which checks for the answer each time an answer/message is submitted. Upon first answer I reduce the endTime till 20 seconds left.</p>
  
  <p>So have 2 questions:</p>
  
  <ol>
  <li>Is this a correct/good practive approach? </li>
  <li>How should I implement it further into the application itself? (setInterval of 1 second with emit? or Simply emit when the endDate is reached? or another way?)</li>
  </ol>