Skip to content

Commit

Permalink
All socket assigned variables are lost during disconnection
Browse files Browse the repository at this point in the history
  • Loading branch information
and1zero committed Nov 19, 2016
1 parent 16fa08d commit f25675c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ io.on('connection', (socket) => {
});

socket.on('disconnect', () => {
socket.broadcast.emit('log', clients[socket.id] + ' has left the chat');
delete clients[socket.id];
socket.broadcast.emit('log', socket.username + ' has left the chat');
});

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

0 comments on commit f25675c

Please sign in to comment.