I have implemented chat application using this (https://github.com/jdutheil/nodePHP),but now i want private chat between two users,but i don't know how to implement it.Please help me to solve the following issue.
When a user logged into his account it will list(using hyperlinks with friends name) his friends like Facebook with a unique id associate with it,on clicking each item it opens new chat page with a text box and a button and start chat.Here is the code
start-chat-with-friends.php
<?php
//uniqueid of the friend
$id=$_GET['id'];
?>
<form class="form-inline" id="messageForm">
<input id="messageInput" type="text" class="input-xxlarge" placeHolder="Message" />
<input type="submit" class="btn btn-primary" value="Send" />
</form>
chatclient.js
$( "#messageForm" ).submit( function() {
var msg = $( "#messageInput" ).val();
socket.emit('join', {message:msg} );
$( "#messageInput" ).val('');
});
chatServer.js**
socket.on('join', function( data ) {
io.sockets.emit('new_msg'+data.to,{message:data.message});
});