mirror of
https://github.com/mizanxali/uno-online
synced 2025-12-06 10:13:27 +00:00
Communicated game logic over socketio server
This commit is contained in:
@@ -14,6 +14,14 @@ app.use(cors())
|
|||||||
io.on('connection', socket => {
|
io.on('connection', socket => {
|
||||||
console.log('connection made')
|
console.log('connection made')
|
||||||
|
|
||||||
|
socket.on('initGameState', gameState => {
|
||||||
|
io.emit('initGameState', gameState)
|
||||||
|
})
|
||||||
|
|
||||||
|
socket.on('updateGameState', gameState => {
|
||||||
|
io.emit('updateGameState', gameState)
|
||||||
|
})
|
||||||
|
|
||||||
socket.on('disconnect', () => {
|
socket.on('disconnect', () => {
|
||||||
console.log('connection lost')
|
console.log('connection lost')
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user