diff --git a/public/style.css b/public/style.css index ab2ab2b..db92fa4 100644 --- a/public/style.css +++ b/public/style.css @@ -54,3 +54,11 @@ footer { padding-top: 1.5em; border-top: 1px solid lightgrey; } + +#buzzer { + width: 90vw; + height: 90vh; + margin: 0 auto; + border-radius: 100%; + background: red; +} \ No newline at end of file diff --git a/server.js b/server.js index 498fa20..de54f5f 100644 --- a/server.js +++ b/server.js @@ -58,12 +58,17 @@ server.listen(process.env.PORT, () => { const wss = new WebSocket.Server({ server }); wss.on('connection', (ws, req) => { - ws.on('message', (message) => { - message = JSON.stringify(message); - console.log(message) - console.log(message.type) - console.log(message.data) - }); + let participant; + ws.on('message', (message) => { + message = JSON.parse(message); + if (message.type === "join") { + participant = message.data; + ws.send('Joined as ' + participant.participantName); + } + if (message.type === "buzz") { + // TODO: Handle Buzzer + } + }); - ws.send('Connected'); + ws.send('Connected'); }); \ No newline at end of file diff --git a/views/room.handlebars b/views/room.handlebars index 15efa15..b2204ca 100644 --- a/views/room.handlebars +++ b/views/room.handlebars @@ -24,25 +24,29 @@