Tips & Tricks on Google Wave extension development ( Seekdroid )

After a week or so having the chance of developing for GW we have come with an extension that can help us show how to explore almost all the capabilities of the API ( as for 07/08/09 )

The reason why we want to do this is that we have found that there are many issues with the documentation provided that need a lot of time to get through. We will try to give some advices we believe that are important while presenting and explaining our new extension.

As an introduction we will here present our extension.

Our aim was to make a directory of robots to be able to inter-actuate with it from a wave directly.

Our extension is called Seekdroid, you can access it by either adding ( seekdroid@appspot.com ) to any wave or visiting the webpage http://seekdroid.appspot.com/

By now it’s quite rudimentary but that’s because we have made it basically for educative means.

The robot allows the following commands:

/list ( number of elements ) – Will list the N last robots in our directory.

/categories – Will list all the categories.
/category name of the category – Will list all the robots of the selected category.

/invite Name – Will add the specified robot to the conversation.

/show Name – Will show the info related to the robot.

/add- Will add the robot to our database and will wait for one of the moderators to accept it’s adhesion to the list.

/leave – Makes Seekdroid leave the conversation ( Not yet implemented because of the API )

/author – Shows information about the authors of this robot.

From a developer’s point of view Seekdroid is formed by a robot, which interacts with wave, a webpage and in a very small part by a gadget which is used to serve as an interface for the robot to allow adding robots to the database.

In this tutorial we want to see in depth the robot part. But we still think that it’s worth it to lightly explain how to understand the rest of the robot and where to start if you want to do any of the other parts on your own.

Where to start?

To be able to program something for Wave at this stage is almost imprescindible to use AppEngine

The documentation on AppEngine is very complete and can be found here

The truth is that having to host the extensions on AppEngine can be a problem sometimes due to limits and restrictions like the inability to use sockets with our robots. Google is working on opening this to allow extensions to ‘live’ in any host.

About the webpage

Seekdroid’s webpage can be fount here, it’s entirely created in python with AppEngine. You will find the information on how to do this on the GAE webpage

The files that contain the webpage and how it’s treated are in ‘dev.py’ ,’index.html’ and ‘admin.html’

About the gadget

As we said before, the existence of a gadget in this extension is merely educational, when we speak about the robot we will point the way to add the gadget from the robot but first you need to know where to start learning about gadgets which can be enterely found here.

Both the documentation about Google AppEngine and the Gadgets API are rather complete so there is no point on repeating what is said on the documentation.

If you have any question about it please ask, we will do our best to answer.

About the robot


On the current documentation of the API, probably the thing that leaks the most is the description of the Robot’s API. It’s comprehensible since it’s heavily exposed to changes.

In this part of the tutorial we intend to make a bit clearer the robot development process.

At this point you should already know how to use the AppEngine but we have to keep in mind a few things:

  • First, the version of the Robot is not the same as the version of the extension. This will be explained later.
  • Second, by now there are not many ways to debug the robots and there are many bugs that are currently affecting the platform.

There are two main ways to debug our robot the first is checking the logs of AppEngine, the second using JDebuggy, you can get here more information about it.

There are two main time consuming problems while developing wave robots with AppEngines at this moment:

  • The inhability to debug our programs with an IDE or something alike.
    ( The JDebuggy robot enables this together with Eclipse )Although quite slow it’s indispensable to be aware of the log console on the AppEngine webpage. There you can find the errors that occurred together with the full history of events.
  • The robot doesn’t respond to events ( maybe just in certain waves ), is it because of wave or because of the Robot?In this case there is no better solution than checking the logs for a time gap or just nothing appearing if we do an event to the robot.

There are many other theories about how to see this, probably just because many people haven’t realised of the existence of the log console on the AppEngine webpage so we think it’s worth repeating once more… Please, check the logs!

At this point we should start analising the robot itself. We think that the best way to expose this is explaining the most important parts and tips and leaving the rest to the comments. Don’t hesitate asking any question. We will try to mantain up-to-date the post and the Wave and answer all the questions as soon as posible.

You can find the source code of the robot here.

The files that we will need to check are: seekdroid.py and app.yaml

About the app.yaml

This file is at the beggining a little bit tricky, let’s try to understand it on an easy way. This file is nothing else than a map. It shows appengine how to treat our application.

On our case we just needed to point:
A script to treat the robot from wave, this is done with

- url: /_wave/.*
script: seekdroid.py

The _wave folder doesn’t have to be created by us, what this says is: “When the client searches for ‘_wave’ run the ’seekdroid.py’ script’” This aplyes to the other handlers as well.

A static directory where to put images ( like the avatar of the robot or a gadget )

- url: /inc
static_dir: inc

Everything in this directory will be uploaded to AppEngine and will be accessible directly from ( in this case ) http://seekdroid.appspot.com/inc/

And finally the webpage itself.

- url: /.*
script: dev.py

- url: /.*
script: dev.py

This point is a little more complex since dev.py will be the one that defines what to do when an url that is neither ~/_wave/ nor ~/inc/ is requested.

Let’s check the dev.py file for a moment.

application = webapp.WSGIApplication(
    [('/', MainPage),
    ('/addRobot', addRobot),
    ('/addRobot_Done', addRobot_Done),
    ('/voteRobot', voteRobot),
    ('/admin', admin),
    ('/validate', admin)],
    debug=True)

This tells GAE what function he has to run when he is requested a certain url.

What function do I use to do that simple thing?

Well, the best way to start is probably checking samples, reading the entire API and practissing.

Reading the entire API helps understand a little bit better the insights of all this and to see what parts of the API hasn’t been completed or just changed.

Why don’t you use this simple macro when you want to search something on the api? Search Macro

I just updated the robot but nothing has changed.

To check if a deploy has been successfully completed the best way is to check the capabilities.xml document.

http://seekdroid.appspot.com/_wave/capabilities.xml

It can tell you what events the robot is listening to and more important, the version of the Robot.

Moreover if the version of two deploys is different, the higher will be the active one no matter when it was deployed.

And there is still something else, the version of the application ( can be found in app.yaml ) isn’t the same as the version of the robot ( in our case in seekdroid.py on the __main__ ) This is said in the manual but maybe isn’t clear enough..

How to add a gadget from a Robot?

__gadget_url__ =   'http://seekdroid.appspot.com/inc/seekdroid_gadget.xml'
gadget=document.Gadget(__gadget_url__)
blip.GetDocument().AppendElement(gadget)

This is quite simple but may be not if searching from the API directly.

Note that to host the gadget in AppEngine we had to put it in the static directoy ( inc ).

This are the main problems we had while coding the robot.

We hope this points will avoid someone wasting his time, as we said, don’t hesitate asking anything either on the blog or the wave.

We will be updating this post with news and interesting comments. Please, stay tuned!

This is the ‘twin’ wave of this post.

Tags: development, Gadget, Google Wave, Robots, seekdroid, Tips


If you like what you see, please, support us:

  • PDF
  • Digg
  • del.icio.us
  • TwitThis
  • Facebook
  • Google Bookmarks
  • StumbleUpon
  • RSS
  • Print


Posts that may be of your interest:

  1. Wave Map – Robot/Gadget
  2. Google Wave in the 2010
  3. News on Wave Gadget Emulators!
  4. Develop your first wave robot in Java
  5. What is Google Wave?

This entry was posted in Robot Development, Wave and tagged development, Gadget, Google Wave, Robots, seekdroid, Tips. Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.