Overview

This project is a real-time voting application developed during Scrum Sprint 4 in CIS 266. Users vote on their favorite programming language — JavaScript, Python, or C# — and results are immediately broadcast to every connected client via Socket.io WebSockets. The server tracks vote counts in memory and uses io.emit() to push updated results to all active sessions simultaneously. A reset button clears the poll and syncs the cleared state across all clients.

Features

  • Live voting with results instantly updated across all connected browser tabs
  • Animated progress bars showing vote percentages per option
  • Poll reset that broadcasts a cleared state to every active client
  • New connections receive the current vote state immediately on join
  • Lightweight architecture — plain Node.js HTTP server with no framework dependencies

Screenshots

Voting Screen Voting Screen

Slides

Slide 1 Slide 2 Slide 3 Slide 4 Slide 5 Slide 6 Slide 7

Code Highlights

// server/index.js — Socket.io connection handler
io.on('connection', (socket) => {
    // Send current results to the newly connected client
    socket.emit('updateResults', votes);

    // Handle incoming vote
    socket.on('vote', (option) => {
        if (votes[option] !== undefined) {
            votes[option]++;
            io.emit('updateResults', votes); // broadcast to ALL clients
        }
    });

    // Handle poll reset
    socket.on('reset', () => {
        for (let key in votes) {
            votes[key] = 0;
        }
        io.emit('updateResults', votes); // broadcast cleared state
    });
});

Challenges & Solutions

Challenge: Keeping all connected clients synchronized in real time without polling or page refreshes.
Solution: Socket.io’s io.emit() broadcasts the updated vote object to every active socket simultaneously. New connections also receive the current state immediately via socket.emit('updateResults', votes) on join, so late-joining clients are never out of sync.

Demo Video

Watch the demo video of the project: Watch Demo