Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

A jQuery plugin for creating near real-time updating widgets without push infrastructure.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 jsonp
Octocat-spinner-32 templates
Octocat-spinner-32 .gitignore
Octocat-spinner-32 README.textile
Octocat-spinner-32 jquery.boiler.js
Octocat-spinner-32 jquery.timers.js
Octocat-spinner-32 jsonpify.py
Octocat-spinner-32 mustache.js
Octocat-spinner-32 test.html
README.textile

Boiler: An experiment in client-side everything.

What the hell?

Boiler is a jQuery plugin that takes URLs to a mustache.js template and a data file (JSON or CSV) mashes them up and inserts their content into the page. Optionally, it will repeat the process of loading the data and regenerating the mashup and a configurable interval.

Why!?

For near-real-time updates without complicated push/comet infrastructure. Clients can poll for a small datafile hosted on very cheap infrastructure (S3, etc.) and render it using a template that was fetched on load. The data file can be updated by a server process with no knowledge of its users and the client can repeat its fetch-and-render cycle very frequently.

The code as written is currently targeted at embeddable widgets, but the principle would be straightforward to apply to full-pages.

Usage

You will need a way to serve the files. I suggest executing the following Python one-liner:

% python -m SimpleHTTPServer

Because this plugin supports cross-site hosting of the template and data files, your files will need to be wrapped in a JSONP callback. Boiler includes a script that will automatically do this for files put into the ‘data’ and ‘templates’ directories. You must run this before running the example:

% python jsonpify.py

Then visit:

http://localhost:8000/test.html

Boiler + Stovetop

Boiler can be combined with Stovetop to
fetch data from Google Spreadsheets.

Is it tested?

Not at all. Only in the latest non-dev Chrome and only on OSX.

Notes/TODO

  • Hashing may be used to avoid re-rendering identical content.
  • Its entirely unclear how fast this is or how frequent polling could be on “average” computers.
  • In the future boiler will take a param specifying how often to poll for new content and automatically show/hide a loading icon (“throbber”) in the rendered template (likely using a magic div id).
  • User needs to handle “no-cache” headers on the data file or the browser will cache the result of the AJAX call.
  • It would make sense for the JSONP requirement to be conditional depending on whether or no the AJAX requests are cross-site.

Credits

All code by Christopher Groskopf—courtesy of a Saturday evening, good whiskey, and Chevelle.

License

MIT.

Something went wrong with that request. Please try again.