Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ app.use('/test', (req, res) => {
console.log('testing')
})

server.listen(process.env.PORT, () => {
server.listen(process.env.PORT || 5000, () => {
console.log(`Example app listening on port ${process.env.PORT}`);
})

9 changes: 9 additions & 0 deletions src/controllers/SessionController.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const SessionController = {
console.log(`Session started, socket: ${socket.id}`)
this.onChooseCard(socket)
this.showAllPickedCards(socket)
this.onResetCards(socket)
this.onDisconnect(socket)
})
} catch (e) {
Expand All @@ -51,6 +52,14 @@ const SessionController = {
this.cards[username] = value
socket.broadcast.emit('pickedCard', this.cards)
})
},

onResetCards(socket) {
socket.on('reset', (value) => {
console.log('Cards reseted!')
this.cards = value
socket.broadcast.emit('showAllPickedCards', this.cards)
})
}
}

Expand Down