mirror of
https://github.com/mizanxali/uno-online
synced 2025-12-08 03:03:27 +00:00
Added text chat functionality
This commit is contained in:
@@ -45,6 +45,12 @@ io.on('connection', socket => {
|
||||
io.to(user.room).emit('updateGameState', gameState)
|
||||
})
|
||||
|
||||
socket.on('sendMessage', (payload, callback) => {
|
||||
const user = getUser(socket.id)
|
||||
io.to(user.room).emit('message', {user: user.name, text: payload.message})
|
||||
callback()
|
||||
})
|
||||
|
||||
socket.on('disconnect', () => {
|
||||
const user = removeUser(socket.id)
|
||||
if(user)
|
||||
|
||||
Reference in New Issue
Block a user