Quiz buttons in node.js

For our recent fall party we made a music quiz, and if you’re quizzin you gotta have some buttonpressin. We looked for quiz buttons at teknikmagasinet, surprisingly we didn’t find anything. So www what do you have to offer? Nothing? Well ok, let’s build some buttons in node.js. Real time web!

5 teams, connected to the same wifi, visit the laptop where node.js is running. They choose a team color (from #A0A to #EE0), and that team color is then removed from the other players screens to choose.

socket.on('claim_team',function(data){
   io.sockets.emit("remove_team",data);
});
If one team push their button no one else can push theirs until the quiz show host resets. On the laptop we see the scores and who pushed first.

Super simple code. The client tells the server that i pushed:

socketio.emit('ipushed', { team : myteam});

And on the server side, change a state and tell the scoreboard to dim the losers:

socket.on('ipushed',function(data){
   if (state == 'open'){
      state = 'locked';
      io.sockets.emit("they_pushed",data);
   }
});

buttons
Blue is winning!

The music questions were pretty nice ones too. Pop songs reworked in different ways – DJ Premierified, Brian Enofied, Bad youtube cover-ified, Dubified etc. This Enofied one was a hit.


Comments

One response to “Quiz buttons in node.js”

  1. jennifer Avatar
    jennifer

    Love it! LOVE IT!