socket.io multiplayer game player's view
<p>I'm very new to nodejs and socket.io. I'm trying to create a simple multiplayer card game in real time. my problem right now is I can't get the player's view to display on the correct <code>div</code> from player's perspective. example is.. I want my playing area to display at the bottom box and my opponent to display on top box and same goes with my opponent's viewer. he will see himself on the bottom div and sees me on the top div. How do u get that effect to work?</p>

<p>client</p>

<pre><code>&lt;div class='top'&gt;&lt;/div&gt;
&lt;div class='bottom&gt;&lt;/div&gt;

&lt;script&gt;
  var socket = io();
  socket.on('playerinfo', function(data){
  $('.top').html(data[0]);
  $('.bottom')html(data[1]);
  });
&lt;/script&gt;
</code></pre>

<p>server</p>

<pre><code>var players = [];
io.on('connection', function(socket){
  //player is given 'P' with random number when connection is made to represent username
  socket.name = "P" + Math.floor(Math.random() * (20000));
  players.push(socket.name);
  io.emit('playerinfo', players);
}
</code></pre>

<p>Also it would be great if you can point me to a tutorial or blog related to this. thank you.</p>