private chat using socket.io in MEAN app
<p>i am trying to include chat features on my MEAN app, all i have completed till now is a medium where all connected users can communicate.not a separate group. i follow some of the tutorials but they do by trick like sending some key words in front of message(whistle as they say).
as far as i know every connected users are provided a seperate socket ID through which communication is carried but  i failed getting that id.</p>

<pre><code>module.exports = function(socket){   
  //console.log(socket);    
  var users =[];

  socket.on('username',function(data){
    users.push({id:socket.id,username:data.message});
    socket.emit('username',users)
  })
  console.log('connected');  
    socket.on('typing',function(data){
      //socket.emit('typing',{message:"helo angular"});
      socket.broadcast.emit('typing',{message:data.message});
  });
</code></pre>

<p>It shows me socket is not defined, any one has better idea how to perform private message using socket.io and node.js<br>
can anyone enlighten me about this.</p>