GroupVote: A Real-Time, Multi-User Voting System Prototype


John Bergmans
Bergmans Mechatronics LLC

Sep 22, 2011


Summary

GroupVote is a simple demonstration of the capability of WebSockets to enable multiple users to vote on an event using desktop or mobile browsers simultaneously and in real-time. The application was developed during MobileHackDays, held in Santa Monica, CA Sep 17-18, 2011.

Bookmark and Share

GroupVote is intended to illustrate how WebSockets can be used to easily create real-time, multi-user, browser-based applications. The application is very much of a prototype since it was developed within the time constraints of the MobileHackDays weekend. Nevertheless, it still demonstrates the unique capabilities offered by the WebSocket interface.

GroupVote was inspired by the Instapol system developed at MobileHackDays by a team from Harvey-Mudd College (and the winners of the event – congratulations to Ozzie, Paul, Rahul and Chuck!) Inspiration was also derived from the InstaPoll Tracker system shown in an episode of In The Know on the Onion News Network (a must-see episode for ONN and real-time web fans, BTW).

System Description

The GroupVote system operates as follows. During the course of an event, users make adjustments to a slider bar in their browsers to indicate their moment-by-moment interest or enthusiasm in the event that they are watching (Figure 1).

Figure 1. GroupVote Screenshot

When the user moves their slider bar, their vote is transmitted as a STOMP (Streaming Text Orientated Message Protocol) message over a WebSocket connection to a Kaazing WebSocket Gateway (Figure 2). The Gateway forwards the STOMP message to an Apache ActiveMQ message broker. The broker then sends the STOMP message to a back-end data aggregator program. As an aside, the Gateway, message broker and aggregator are all located on a cloud server.

Figure 2. GroupVote System Diagram

Once every second, the aggregator, written in PHP, computes the average of each user's current vote. This average value, along with the current vote of every user and some diagnostic information, is sent as a comma-delimited string in a STOMP message via the message broker, Gateway and WebSocket connection to each user's browser. In this demo, the data is displayed in text format as shown in the screenshot in Figure 1, but could be easily be parsed and displayed in graph form as in the Onion InstaPoll system and in Bergmans Mechatronics' collectdViewer server monitoring system.

Discussion

Although GroupVote is a very simple system and there is much room for improvement, particularly in the UI, the system does demonstrate two important properties of WebSockets:

  1. data can readily be transmitted asynchronously from multiple browsers to a central, back-end processing program; and,
  2. a back-end program can easily push aggregated data back out to multiple browsers, without browser polling

These two properties make WebSockets ideally suited for many large-scale, multi-user applications in fields such as entertainment, finance and business intelligence.

Please contact Bergmans Mechatronics if you'd like to discuss applications for WebSockets or would like to see a live demo of GroupVote. Comments are welcomed in the section below.

About Bergmans Mechatronics

Bergmans Mechatronics LLC, founded by John Bergmans in 2003, performs WebSocket application research and development and training.  In addition, BML develops custom data acquisition and control system software.  The firm’s client base includes companies in the software, industrial, medical, and defense sectors.

e-mail: jbergmans@bergmans.com
phone: 714-474-8956
twitter: @jbergmans
web: www.bergmans.com

Comments

blog comments powered by Disqus

© 2004-2011 Bergmans Mechatronics LLC