Skip to content
This repository has been archived by the owner on Jun 19, 2024. It is now read-only.

Commit

Permalink
join/leave messages
Browse files Browse the repository at this point in the history
  • Loading branch information
cinaryilmaz committed Jun 17, 2022
1 parent 3d0bf04 commit 05d95da
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ app.get('/', (req, res) => {
app.use(express.static('static'))

io.on('connection', (socket) => {
console.log('a user connected');
io.emit('chat message', "User " + socket.id + " has joined.", "System");
socket.on('disconnect', () => {
console.log('user disconnected');
io.emit('chat message', "User " + socket.id + " has left.", "System");
});
socket.on('chat message', (msg, id) => {
io.emit('chat message', msg, id);
Expand Down

0 comments on commit 05d95da

Please sign in to comment.