Skip to content

Commit

Permalink
Should send message to one user
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadowCat567 committed Apr 24, 2024
1 parent cad7e6d commit 8950c1b
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions back-end/Server.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ io.on('connection', (socket) => {
console.log(`a user has connected, user id = ${socket.id}`);

socket.on('chat_message', (msg, otherUser) => {
console.log(`Other user: ${otherUser}`);
console.log(msg);
io.emit('chat_message', msg);
io.to(otherUser).emit('chat_message', msg); //I think this will work...
});

socket.on('disconnect', () => {
Expand Down

0 comments on commit 8950c1b

Please sign in to comment.