← Projects — CIS 266
Scrum 4 — Real-Time Voting with Socket.io
A real-time polling application built with Node.js and Socket.io that broadcasts live vote results to all connected clients instantly — no page refresh required.
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
Slides
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
