Update chat.js
Browse files
chat.js
CHANGED
|
@@ -23,7 +23,7 @@ io.on('connection', (socket) => {
|
|
| 23 |
|
| 24 |
// Listen for chat messages
|
| 25 |
socket.on('chat message', (msg) => {
|
| 26 |
-
const username = usernames[socket.id] || '
|
| 27 |
io.emit('chat message', { username, message: msg }); // Broadcast the message with username
|
| 28 |
});
|
| 29 |
socket.on('keys', (msg) => {
|
|
|
|
| 23 |
|
| 24 |
// Listen for chat messages
|
| 25 |
socket.on('chat message', (msg) => {
|
| 26 |
+
const username = usernames[socket.id] || 'Non specified name';
|
| 27 |
io.emit('chat message', { username, message: msg }); // Broadcast the message with username
|
| 28 |
});
|
| 29 |
socket.on('keys', (msg) => {
|