add left chat
This commit is contained in:
parent
c14c46a444
commit
8547ebf403
1 changed files with 7 additions and 0 deletions
|
|
@ -82,6 +82,13 @@ io.on('connection',socket => {
|
||||||
|
|
||||||
socket.on("disconnect", function() {
|
socket.on("disconnect", function() {
|
||||||
console.log(`${getUsername} left the chat.`);
|
console.log(`${getUsername} left the chat.`);
|
||||||
|
socket.broadcast.emit('general',[{
|
||||||
|
username: 'Server',
|
||||||
|
date: new Date(),
|
||||||
|
channel: 'general',
|
||||||
|
message: `${getUsername} left the chat.`
|
||||||
|
}]);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Reference in a new issue