title: why isn't the socket connection counter updating?
body: <p>this is the code I have in an index.html (client). Im wondering why the number is not being incremented. I expect on each time a socket connect I give it a unique name.</p>
  
  <pre><code> var number = 0;
  
      socket.on("connect",function(){
           number = number+1;
  
          socket.emit("add user","user"+ number )
  
  
      })
  </code></pre>
  
  <p>but when i have this server</p>
  
  <pre><code>io.on("connection", function(socket){
  
      console.log("io.onconnection")
      socket.on("add user", function(data){ 
      console.log(data)
      })
  });
  </code></pre>
  
  <p>on each connection i get logged <code>user1</code>, <strong>why</strong> isn't the second connection <code>user2</code>? thanks</p>