Version 0.1
A very serious, industrial web framework in Tcl
 All Data Structures Namespaces Files Functions Variables Pages
Getting started

Installation

Currently, tänzer does not provide an installer. However, installing it by hand is a trivial affair. From the tanzer/ repository root, do this:

1 sudo cp -r lib /usr/lib/tanzer0.1

Any other directory indicated by $::tcl_pkgPath is a suitable place to install tänzer as well.

Or, simply use tänzer in place, setting the $TCLLIBPATH environment variable as appropriate to include the lib/ subdirectory.

The tänzer event model

tänzer provides a fairly thin layer of HTTP/1.1 parsing and generating semantics on top of the Tcl event loop, exposing the user to some of the intricacies of handling the many individual read and write events that come part and parcel with servicing many sessions asynchronously and in a concurrent fashion. The rationale is this: Not every request needs to be fulfilled and responded to in a single sitting, but incrementally, with event handlers should deal with a small part of handling their respective requests dealing with things in a granular fashion, one chunk at a time.

tänzer is similar to Node.js in that it provides request parsing, response sending and message body I/O with very little abstraction. tänzer differs from Node.js in that the developer is actively encouraged by its API to handle as little as possible per I/O event. Furthermore, tänzer, as a project, is much smaller in scope than Node.js as it focuses purely on facilitating the crafting of HTTP/1.1 services, delegating all other functionality to the tried-and-true rich Tcl platform.

Your first "Hello, World!" with tänzer

Open the examples/simple.tcl file in your favorite editor and look around. Notice that the event handler for the sole route in that file is a single command called simpleResponder, which accepts two required arguments, $event and $session, and an optional argument, $data. The $event argument will always be one of the following values:

The $session argument specifies a tanzer::session object for the current session. And, as previously mentioned, a third argument is available in $data, when data is available and accompanies a read event.