Overview

This is an example of using the Flask web framework along with long-polling (aka Comet, aka reverse AJAX) techniques to update client state quasi-asynchronously without the benefit of direct Web Socket support. The server-side code runs in Python; the front-end Web page client runs in the browser (in JavaScript).

This is very much a "poor man's" form of interactivity. Refreshes are occasional, the delays between updates are many seconds long, etc. I've successfully used the technique in production apps, but it will become obsolete as soon as quality support for Web Sockets becomes simple and reliable. As of Summer 2013, that time has arrived; I will soon publish a version of this example that uses Web Sockets and Flask quite simply.