by November 7, 2009 0 comments



Google Wave is an innovative idea by Google which is going to build a new
standard of communication. Call it as, a new collaboration tool, a new email
service, or a step near to real time programming; all of them hold true at some
level or other. An official definition of Google Wave is: ‘Google Wave
introduces a new platform built around hosted conversations called waves -this
model enables people to communicate and work together in new and more effective
ways.’

What is new in Google Wave?
There are many services today that enable you collaborate with people; some
offer live concurrent editing, such as EtherPad and SubEthaEdit, but do not
offer rich text, there are others that offer rich text, such as Google Docs, but
do not offer a seamless live concurrent editing experience. However, with Wave
you can do live editing of rich text document. Google Wave allows you to share
photos as you do in an online photo gallery, do an instant messaging type of
communication and live transmission inside a single application. This means, the
usage of different applications is not required if you are using Google Wave.
You can not only perform a Google search from within the Wave, but can also tag
the newly created waves so that public waves can get indexed for searching
purpose.

Direct Hit!

Applies To: Developers
USP: Extensible, scalable communications,
open source platform from google
Primary Link: wave.google.com
Keywords: Google Wave

The most interesting thing about Google Wave is Google Wave Federation
Protocol (GWFP) which powers this new communication mechanism. This protocol is
Open Source and hence everyone can involve in the development of this protocol
very easily. Releasing this protocol as an Open Source project gives developers
more control and will help in their odyssey.

This signifies Google needs help from Open Source community to contribute to
the Google Wave project. Google Wave is extensible in many forms -gadgets,
robots etc. You can build your own robot/bot in Google Wave if you know any of
Python, Java, JavaScript, ActionScript. The already created bots can be found
here in Google Wave Sample Gallery

http://wave-samples-gallery.appspot.com/

The Geek Wave?
Let us now delve into Google Wave from a geek’s perspective. Google Wave
Federation Protocol is an extension of XMPP Internet Messaging protocol. The
underlying GWFP uses Operation Transformation (OT) technology for concurrency
control. Waves are hosted XML documents that allow concurrent modifications.
Wave is also referred as ‘Hosted Conversations’ as explained in the last line.
As everything is hosted on XML documents, there is lot more (structured data)
than just rich text which can be edited concurrently.

Wave maintains a local copy of shared documents at all end user’s site and
allows user to edit any part of document any time. There is no lock-in for the
local editing which is responsible for optimized user interface. When the remote
operations are executed, it is then transformed as per OT mechanism. The
lock-free, non-blocking property of OT makes the local response time insensitive
to networking latencies. Wave system implements client and server based OT as
explained by the ‘High-latency, low-bandwidth windowing in the Jupiter
collaboration system’ ( http://doi.acm.org /10.1145/215585.215706).

Wave showing how real-time communication works. The receiver
does not even have to wait for the sender to hit Enter. Receiver is able to
see the message character by character which removes the latency in
communication.

Wave providers
Yes you read it right; you can be a Wave provider as well. GWPF being an
Open Source allows everyone to become a Wave provider. An organization can be a
provider and can run Wave service using a Wave server which will support all
operations like IM, email, real time collaboration, etc. So this signifies that
Google is nothing but a major Wave provider.

A Wave Robot
We have done a lot of talking about the Wave; now let’s experience the power
of Wave by creating our own Wave Robot. For now, the robot which we are going to
create can only be used by the users who have their Wave accounts. Currently the
robots which are hosted on Google App Engine (GAE) are supported by Google Wave.

Prerequisites: You need to download Python 2.5.x or above. Once you have
installed Python, download and install Google App Engine SDK, which will allow
you to upload your script files on to GAE server. Register a new application on
GAE http://appspot.com or you can also use the one which you have already
registered. Download the Google Wave robot python client library from (http://code.google.com/p/wave-robot-python-client/).
If you are on Linux, then you can also checkout the latest files using the
following command.

svn checkout http://wave-robot-python-client.googlecode.com/svn/trunk/
wavelib

But if you are on Windows and have no SVN client installed, then simply
download the zipped file and extract its files to a folder. For this example, we
are keeping these library files in the folder named ‘wavelib’.

Now we have setup a complete environment to create our Wave Robot. Let us now
create script files which will allow the robot to respond inside your Google
Wave account. Start by creating a meta information file i.e. app.yaml

application: your_app_name
version: 1
runtime: python
api_version: 1
handlers:
– url: /_wave/.*
script: your_app_name.py
– url: /assets
static_dir: assets

Do take care of the indents as Python is indent sensitive language. Also you
can change the script file name if you want to, but keeping it same as the
application name is a customary.

Now let us create the script file which acts as the muscles of your shiny new
robot. Create a new file with the same name as specified in front of script in
app.yaml

your_app_name.py

from wavelib import events
from wavelib import model
from wavelib import robot

def OnParticipantsChanged(properties, context):
"""Invoked when any participants have been added/removed."""
added = properties[‘participantsAdded’]
for p in added:
Notify(context)

def OnRobotAdded(properties, context):
"""Invoked when the robot has been added."""
root_wavelet = context.GetRootWavelet()
root_wavelet.CreateBlip().GetDocument().SetText("Thanks for adding !")

def Notify(context):
root_wavelet = context.GetRootWavelet()
root_wavelet.CreateBlip().GetDocument().SetText("Hi, from My Robot")

if __name__ == ‘__main__’:
myRobot = robot.Robot(‘ your_app_name ‘,
image_url=’http://yourdomain.com/your_logo.gif ‘,
version=’1′,
profile_url=’http:// your_app_name.appspot.com/’)
myRobot.RegisterHandler(events.WAVELET_PARTICIPANTS_CHANGED,
OnParticipantsChanged)
myRobot.RegisterHandler(events.WAVELET_SELF_ADDED, OnRobotAdded)
myRobot.Run()

Explanation
The python client library which we checked out from Google Code contains all
the necessary functions, events to create a Wave robot. So we need to import all
the required files which we have done in the first 3 lines. If you have
specified a different folder name when checking out the files then you need to
replace the folder ‘wavelib’ to the one you have specified while checking out.

The twittergadget function inside a wave. It allows you to
send new updates and refreshes the wave after regular interval of time to
fetch new updates from Twitter.

When the robot is added to a wave it acts like a daemon process which can be
triggered on the event defined in your script file’s __main__ function. For this
example, we are listening to two events; WAVELET_SELF_ADDED and
WAVELET_PARTICIPANTS_CHANGED. The first event gets fired when your robot is
added to any wave created by the user, while the second event gets fired when
someone is added or removed from the wave in which your robot is added. We have
registered the corresponding functions using RegisterHandler() function. These
functions are defined just before the __main__ function.

Notify() function is an example to create a new blip corresponding to the
blip above. We need to call this function explicitly as we are not guaranteed to
get discrete events for each participant added in the wave. A wave is identified
by a globally unique Wave ID.

__main__ function invokes the events and is also responsible for defining
profile_url of your robot, which is not used for any purpose currently. But you
can specify an image for image_url that will display as display image for your
robot.

Uploading the Robot to GAE
You need to upload these files to make your robot working for you and for
the rest of the world. If you are on Windows, then the default directory where
GAE is installed should be c:\Program Files\Google\google_appengine. Now open
the command prompt and browse to the folder where GAE is installed (you need to
do this, if its path entry is missing) and type the following command to upload
your files to the server.

appcfg.py update <path_to_script_directory>

The script directory would certainly contain the python library client folder
and the other two files, that are, app.yaml and your_app_name.py
If you are on Linux then, open the Terminal and type the same command but make
sure your working directory is where SDK is installed.

Invoking the Robot
It is very simple to use your newly created shiny robot. inside Google Wave
add a new contact with the name your_app_name@appspot.com. After adding new
contact create a new wave with your robot as participant, it should talk back.

Example of Twitter robot
A very nicely scripted robot to update your twitter status is already
created. All you have to do is to add tweety-wave@appspot.com in your contacts
and create a new wave after clicking this robot from the contact list. It will
allow authenticate you using OAUTH and then you can update your status.

Another Google Gadget called ‘twittergadget’ can be added in Wave to update
twitter. To add this gadget, create a new wave and click on ‘Add gadget by URL’
icon in the toolbar, now enter the URL as http://www.twitte rgadget.com/gadget_gmail.xml
. You will be asked to provide twitter credentials, this gadget does not use
OAUTH method unlike to the above robot.

Summary
Google Wave is powered by an Open Source protocol and you can contribute in the
project if you want to. You can develop many new gadgets, robots using its
extensible framework.
References:


http://en.wikipedia.org/wiki/Operational_transformation

http://tinyurl.com/lca2mj

Sachin Khosla, Founder, Digimantra

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.

Your data will be safe!Your e-mail address will not be published. Also other data will not be shared with third person.