Search code examples
javascriptcoldfusionticker

Is there Push functionality for Coldfusion to create a live ticker?


We are hosting a contest on our website where visitors can vote for their favorite contest entry. We are getting a lot of traffic, and a lot of votes.

We would like to add a ticker to our homepage that updates live whenever a vote is cast to show the total number of votes.

Our website is run on a Coldfusion 10 server.

The only way I know how to do this is by running a JavaScript function that runs every second or so and that would run an ajax command to call another page that just runs the query to return the total votes. That seems like it would eat up a lot of bandwidth when you take hundreds of users polling every second.

Is there a better way that would not result in a huge bandwidth drag? Maybe some sort of "push" functionality for Coldfusion that can be used?


Solution

  • This is the most through and complete tutorial I have used on the subject. Walks you through everything.

    http://www.adobe.com/devnet/coldfusion/articles/html5-websockets-coldfusion-pt1.html

    Except they never touch on making sure the port is open on your server. We user WIN 2008 Server and by default the Firewall blocks it.

    At it's most basic level you do three things:

    1. Add the channel to your App.cfc
    2. Add a listener on the page where you are going to use the data (listen to the channel)
    3. Add the page to publish the data (post to the channel)

    There are a ton of other things you can do to process the data at each step.