I´ve been searching for the anwser but most of them i cant quite connect with my code so im hoping to get some help.
I want to send a message for a specific user, like a chat beetween 2 people.
For example, if i choose John how can i only send a mensage to him? im having much trouble in this
app.js
io.on('connection', function (socket) { socket.on('chat', function (data) { console.log(data); //Specific user //socket.broadcast.to(socketid).emit('message', 'Hello'); }); }); I have a mongodb database so how can i specify the socketid having the user id of the select user?
