You can try the code below:
whenever a user joined to the server, socket details will be generated including ID. This is the ID really helps to send a message to particular people.
First we need to store all the socket.ids in array,
people[name] = socket.id;
here name is the receiver name.
So, now we can get that socket.id with the receiver name whenever we are sending message for this we need to know the receivername.
Hope this work!!