Introduction to the google wave federation protocol - the short and sweet version

In this post, we are going to install the google wave protocol reference implementation, further explore its mechanisms, and most importantly, learn something new and exciting (I hope) and, not least of all, have fun in the process.

I did this on a linux machine, ubuntu 9.04. All the steps described herein should also be adaptable to whatever OS you happen to be using, easily.

Required tools

To install java 6 on an ubuntu box, just type in the following command in your favorite shell.

sudo aptitude install sun-java6-jre sun-java6-fonts

Mercurial is a distributed SCM and it is needed to pull the code base from the google code repository. To install mercurial, issue the following command:

sudo aptitude install mercurial

Ant is needed to build the code base that we are going to pull from the google code repository. To install ant, type the following command in your favorite shell:

sudo aptitude install ant

Installing the openfire XMPP server

Now, we need to install the openfire XMPP server. First we need to download it with the following command, to get the *.deb file. Or the *.rpm if you are on a redhat linux based system.

wget http://www.igniterealtime.com/downloadServlet?filename=openfire/openfire_3.6.4_all.deb

This will download the file into your current directory. Once that's done, you can, optionally, issue an "ls *.deb" command to insure that it is there. To install it, issue

sudo dpkg -i openfire_3.6.4_all.deb

One other option is to install it manually. Either way works fine. If you are using a different platform, you can get a distribution for your platform here. After downloading the proper version for your platform, follow the installation instructions. Under the "openfire_version/documentation" directory, you should find the configuration instructions.

Configuring Openfire

Switch to a web browser and type in the URL "http://localhost:9090". You should be redirected to the setup page. In the options, you can safely stick to the default values. Click the "save settings" button and restart openfire:

sudo /ect/init.d/openfire restart

Once the server restart, go back to the "http://localhost:9090". This time, you should be presented with a login screen. The username is "admin" and the password is one that you selected in the set-up screen.

Once you have logged into the server, on the secondary menu, select the "server settings" menu and on the left hand submenu, select "external components". We need to configure the google reference implementation, because it is precisely that-an external server component. From there, select "enabled" to allow external components to connect to this server and choose a shared secret. Click "save settings".

Once that is done, you should have another box show below that says "Allowed to connect", in the subdomain box enter "wave" and the shared secret, enter your shared secret, that you chose in the previous step.

At this point, you should have something that looks like this

Then click the "save settings" button.

Once that is done, again in the left hand submenu, click the "security settings". In the "Server Connection Security", you can keep the default values as is, but make sure you enable "accept self signed certificates" and then click the "save the settings" button.

Generating certificates

To generate the key and certificate, here is a little shell script to help quickly generate them.

#!/bin/bash

NAME=$1

if ["$NAME" == '']
then
    echo "$0 " 1>&2
    exit 1
fi

openssl genrsa 1024 | openssl pkcs8 -topk8 -nocrypt -out $NAME.key
openssl req -new -x509 -nodes -sha1 -days 365 -key $NAME.key -out $NAME.cert

To use this script, just invoke it with the name of your localhost machine as a parameter. If you don't know what your machine is called issue: "hostname" on the command line. At this point, configuration of the openfire XMPP server is complete.

Getting the google wave protocol reference implementation

Earlier on, we installed mercurial. We are going to use it to fetch a copy of the reference implementation from the google code repository with the following command:

hg clone https://wave-protocol.googlecode.com/hg wave-protocol

Once that is done, go into the "wave-protocol" directory and run "ant". This will build everything and create a "$HOME/whereveryoupulledthewavesource/dist" directory with the jars that resulted from the build. There should be 2 jar files in there.

Now, go back one directory up and you should have 2 script files. One, run-server.sh is to launch the server and the other run-client.sh is to launch to client. Obvious enough!

Before launching the server, we need to modify to the run-server.sh file to

  • comment out the echo statement
  • add the absolute paths to the key and certificate
  • add your hostname for CERTIFICATE_DOMAIN_NAME
  • and finally, add the shared secret, you configured earlier for openfire, for the XMPP_SERVER_SECRET

And now, we can run the run-server.sh script and it will launch the server. You should see server log info in shell (CLI-Command Line Interface). That is all for the server.

Okay, so now, before launching the client, open the run-client.sh file in your favorite editor and:

  • comment out the echo statement
  • add your hostname to WAVE_SERVER_DOMAIN_NAME

and now, you can invoke the script with a username (any name you choose) as a parameter. You should now see a 2 pane window. You can type "/help" to see all the commands that you can use.

For more info, have a look at the source code in the "wave-protocol/src" directory! For further reading, I highly recommend the following:

Happy discovery!

0 comments:

Post a Comment