feat(*): Handle emoji throwing on server

This commit is contained in:
Josh Creek
2023-07-12 11:14:05 +00:00
parent a4e573d5b9
commit 5b9bd29382
5 changed files with 111 additions and 27 deletions
+14 -1
View File
@@ -110,7 +110,11 @@ wss.on('connection', (ws: WebSocket, req) => {
if (allEstimates.size === room.getUsers().length) {
const users = room.getUsers();
const average = calculateAverageEstimate(users);
broadcastToRoom(room.id, { type: 'estimation-closed', average, groupedEstimates: groupEstimates(users)});
broadcastToRoom(room.id, {
type: 'estimation-closed',
average,
groupedEstimates: groupEstimates(users)
});
}
}
}
@@ -124,6 +128,15 @@ wss.on('connection', (ws: WebSocket, req) => {
const users = room.getUsers();
broadcastToRoom(room.id, { type: 'user-estimates', users });
}
} else if (data.type === 'trigger-emoji') {
const { cardId, emoji } = data;
if (room) {
broadcastToRoom(room.id, {
type: 'trigger-emoji',
cardId,
emoji
});
}
}
});