mirror of
https://github.com/abrendan/MicDropMessages.git
synced 2025-08-25 14:02:03 +02:00
Added a "User left" message when someone leaves from a chatroom
This commit is contained in:
7
index.js
7
index.js
@@ -36,4 +36,11 @@ io.on('connection', function(socket){
|
||||
socket.on("recieve", function(message){
|
||||
socket.emit("recieve", message);
|
||||
})
|
||||
|
||||
socket.on("leave", function(room, username){
|
||||
if (room && username) {
|
||||
socket.leave(room);
|
||||
io.in(room).emit("recieve", "Server : " + username + " has left the chat.");
|
||||
}
|
||||
});
|
||||
})
|
||||
|
Reference in New Issue
Block a user