TCP Sockets and Athena

by Dylan SchiemannJuly 7th, 2008

Michael Carter’s recent Sockets in the Browser has received significant interest. JP Calderone wrote an example of a TCP sockets implementation for Athena in five minutes.

For anyone that hasn’t heard of Athena, it is a Twisted Python-based Comet implementation. For those familiar with LivePage (used in a number of Ajax and Comet demos including the sorely missed Jot Live) or Nevow, Athena supersedes LivePage and is worth a look.

A brief description of Nevow and Athena from the Nevow project site:

Nevow - Pronounced as the French “nouveau”, or “noo-voh”, Nevow is a web application construction kit written in Python. It is designed to allow the programmer to express as much of the view logic as desired in Python, and includes a pure Python XML expression syntax named stan to facilitate this. However it also provides rich support for designer-edited templates, using a very small XML attribute language to provide bi-directional template manipulation capability.

Nevow also includes formless, a declarative syntax for specifying the types of method parameters and exposing these methods to the web. Forms can be rendered automatically, and form posts will be validated and input coerced, rendering error pages if appropriate. Once a form post has validated successfully, the method will be called with the coerced values.

Athena - Finally, Nevow includes Athena, a two-way bridge between JavaScript in a browser and Python on the server. Athena is compatible with Mozilla, Firefox, Windows Internet Explorer 6, Opera 9 and Camino (Don’t see your favorite browser?). Event handlers can be written in pure Python and JavaScript implementation details are hidden from the programmer, with Nevow taking care of routing data to and from the server using XmlHttpRequest. Athena supports a widget authoring framework that simplifies the authoring and management of client side widgets that need to communicate with the server. Multiple widgets can be hosted on an Athena page without interfering with each other. Athena supports automatic event binding so that that a DHTML event (onclick,onkeypress,etc) is mapped to the appropriate JavaScript handler (which in turn may call the server).

One Response to “TCP Sockets and Athena”

  1. David Davis Says:

    “Five minutes later I had this untested code:”


Copyright 2015 Comet Daily, LLC. All Rights Reserved