PunJab - A Jabber HTTP client interface.
PunJab is a HTTP, jabber client interface. It is a SOAP, XMLRPC, JEP-0025, or JEP-0124 server that allows persistent client connections to a jabber server. It can be used for many things, but its main purpose is to allow for stateless applications (ie web) a stateful connection to jabber.
News
Downloads
CVS
Docs
Bugs
JWChat HOWTO
Demo
XMLRPC API
About PunJab
XMLRPC Demo
SourceForge.net Logo

How to use JWChat with Punjab.


This page will describe in detail a working version of punjab and client.

First, an overview of punjab. Punjab is sort of a blackbox. It has a HTTP Polling interface that client's make connections to and it then sends them to a jabber server. What goes on in between does not really matter to the client developer.

What problem are we trying to solve?


Punjab was created to allow stateless systems a way to interact with jabber, a very stateful system. Jabber or XMPP is a powerful, extendable, and easy to use xml messaging protocol. It is mostly used for instant messaging, but can be used for many other applications. Anyway, the problem JWChat solves is web based instant messaging. Or a web based jabber client.

The details and getting this thing to work.


Step one is to setup punjab. To do this, all you need is a computer, python and twisted. Sets on setting up python and twisted are not included in this HOWTO. Download punjab and follow the installation instructions in the INSTALL file. The dependencies are listed in the INSTALL file.

Now, we untar that file in a directory.

shell> tar vxzf punjab-X.X.tar.gz


Change into the punjab directory and switch to root and run setup to install the libs
shell>cd punjab-X.X

shell>su

shell#>python ./setup.py install


Now, we can set up a punjab server. First, you will have to copy the html files to a directory or use the directory here.
shell>cp -r html/ /var/www/punjab

After that we change to a directory we want punjab running in and run mktap to create the punjab server. This can be any directory you would like.
shell>cd /path/to/punjab/server/directory/


shell>mktap punjab --help


shell>mktap punjab -b 1 -p 1 -s 1 -x 1 --html_dir=/var/www/punjab

GET JWChat


Get the files for the download site located at the following URL : http://jwchat.sourceforge.net/download.shtml
Edit jwchat/config.js Something like the following :


var BACKENDS =
[
                {
                        name:"HTTP Polling",
                        description:"Punjab's HTTP Polling Backend",
                        httpbase:"http://localhost:5280/httpp/",
                        type:"polling",
                        servers_allowed:['localhost']
                },
                {
                        name:"HTTP Binding",
                        description:"Punjab's HTTP Polling Backend",
                        httpbase:"http://localhost:5280/httpb/",
                        type:"binding",
                        default_server: "localhost"
                        // NOTE : this can be jabber.org or something else
                },

];
NOTE: You can use binding, but it will still poll.

Install JWChat into punjab's html directory.


shell>cp -r jwchat /var/www/punjab/jwchat/
shell>cd /var/www/punjab/jwchat/
shell>perl -e 'for my $file (split("\n",`ls *.en`)) { $tmp = $file; $tmp =~ s/\.en$//gi; rename($file,$tmp);}'
The perl statement is because twisted does not support multi-view. So, you have to run that. Inorder to get other languages use the .ext for that language. This example is english, so we use .en

Run Punjab!


shell>twistd -f punjab.tap


We should now be set to run JWChat.

With a browser go to http://localhost:5280/jwchat/

GOOD LUCK! HAVE FUN!

If not, then let me know!