Skip to content

Commit

Permalink
bug(chat): fix broadcast issue
Browse files Browse the repository at this point in the history
fixes reception of message to the sender
[Finishes#170609744]
  • Loading branch information
alainmateso committed Jan 9, 2020
1 parent 84a96a2 commit 2009a48
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/controllers/chatController.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const chat = (io, socket) => {
const userInfo = await models.users.findOne({ where: { id: user.payload.id } })

if(!target.userId){
io.emit('chatMessage', { sender: userInfo.username, message });
socket.broadcast.emit('chatMessage', { sender: userInfo.username, message });
const newChat = { userId: user.payload.id, message };
models.chats.create(newChat);
}else{
Expand Down

0 comments on commit 2009a48

Please sign in to comment.