how to make a chat between two people with android socketio module on nodejs server?

I work to develop a chat app with android on node.js server.I made a simple chat app.But everyone gets involved in the same room.I want to make a chat between only two people.How can I do that? What information should I send to the server?such as sender_name,receiver_name,message as a json format.

-How can I to do list online-users?

-And How can I start a chat between only two people?

What are the requirements for it?

This might help:

I'd recommend setting up namespaces for each room you have your chat in. I did something similar in my own code. Note: Rooms and namespaces are a little different from each other in socket.io itself (socket.io has both: http://socket.io/docs/rooms-and-namespaces/).

In the Server code:

I have a method under socket.on('connection') that is similar to

socket.on('groupConnect', function(group){
    var groupNsp = io.of('/' + group);
}

This essentially makes sure that a namespace is exists under the name of the desired one. It doesn't mess it up or reset the namespace when it is called again.

Then for receiving the messages:

socket.on('message', function(data){
    var msg = data.msg;
    var nsp = data.nsp;
    io.of(nsp).emit('message', msg);
}

You could also add the nsp to the data you have already and then just send the data again to the clients.

Then, in the client code:

var socketOut = io.connect('http://yourdomain:1337/');
var someGroupOrMethodToGetGroup;
socketOut.emit('groupConnect', someGroupOrMethodToGetGroup);
var nsp;
setTimeout(function(){
    socket = io.connect('http://yourdomain:1377/' + someGroupOrMethodToGetGroup);
    socket.on('message', function(msg){
        displayMessage(msg);
    }
    nsp = '/' + someGroupOrMethodToGetGroup;
}, 1500);

Then in my displayMessage code I have:

socketOut.emit('message', { msg: desiredMessage, nsp: nsp });

From another answer of mine (http://stackoverflow.com/a/24805494/3842050).