Script, random chat, how?

Hello there I have a question. I wrote a chat room, according to the principle pogovorisomnoi.ru random chat without registration) How to write? I wrote a script to connect the first two users, but the code is not modified, because when the client sends the message to the server, the server does not know to whom it sends to the last room. Here is the code:
socket.on('getIns', function(){

 if(queue.length == 0) queue.push(socket);
 else {

 room = "public-"+(++room_id);
 queue[0].join(room); 
socket.join(room);
 io.sockets.to(room).emit('getIns', room);
 queue = queue.slice(1, queue.length);
}

 });

The client sends the key getIns, the server it connects and warns that we got hooked up, everything works, but the server does not know to whom to send the message, someone in a room. How it is possible competently to make? Thanks in advance)
July 12th 19 at 16:34

Find more questions by tags Node.jsSocket.io