title: How to use websockets for real-time gaming
body: <p>I want to make a 2 player pong game that uses websockets and node.js server. <a href="http://socket.io">socket.io</a> is used on both client and server. So far, my only experience is creating a chat application.</p>
  
  <p>This is my first attempt at a multiplayer game so I'm not so familiar with network gaming. Should the server keep track of:</p>
  
  <ol>
  <li>Every position the ball is at and how often or when?</li>
  <li>player movement, player move left or right, what if I press and hold for awhile, how do I handle this? Should I send like a <code>pressHoldStartPosition</code> and <code>pressHoldStopPosition</code>? I guess this is easy if I only allow pressing but not holding down.</li>
  </ol>
  
  <p>My thoughts:</p>
  
  <ol>
  <li>When the ball hits a player, the client calculates velocity, start and end position and the other client should perform the correct animation from that.</li>
  <li>No idea.</li>
  </ol>