Lets Shindig!

At this year's Google Developer Day in Sydney, Dan Peterson and John Hjelmstad talked about Apache Shindig, an open source implementation of OpenSocial and gadgets.

Following the introductory presentation on OpenSocial at the Google Developer Day conference in Sydney, Dan Peterson and John Hjelmstad delved into the workings of Shindig with their presentation "Apache Shindig: Make your social site an OpenSocial container".

What is Shindig?

Shindig, a project in Apache Software Foundation Incubation is an open source implementation of OpenSocial and gadgets.

At present Shindig provides two ports, one in Java and one in PHP, both of which support version 0.7 of OpenSocial. There is work in progress for version 0.8 which will introduce the RESTful API. Some containers using the Java version of Shindig are hi5, iGoogle and orkut.

There is a strong open source community behind Shindig, producing some high quality code, with updates occurring as OpenSocial evolves.

Shindig Architecture

Dan and John showed a diagram similar to the one below to illustrate the structure of Shindig. It is made up of three main components.

|> Gadget Server:

OpenSocial gadget is going to be composed of HTML, CSS and JavaScript encapsulated inside an XML file. The Gadget Server will process that XML file and render it inside an iFrame. Shindig downloads your gadget and takes in the metadata, upon which it performs translations to deliver the content to the user in their language. It then looks at the preferences that might have been set, by taking in the variables and doing substitutions on the gadget content. Next up, it examines the features which are JavaScript libraries, so the gadget can behave in a certain way on the social site. An example of a feature is all the different views of a gadget. The final product is the HTML rendered inside an iFrame.

|> OpenSocial data server:

This server needs to be on the same domain as the gadget, as they talk to each other. Social information is exchanged with the gadget via a JSON wire format. There are three kinds of social information, they are: people, friends and activities.

Version 0.8 will introduce the RESTful API for non-JavaScript access to OpenSocial data. This will provide developers with the opportunity to build more interesting apps and for external sites to interact with social information.

The data server also provides persistent data storage for gadgets, but there is a limit to how much you can store.

The benefit of all this to developers is that they do not need any infrastructure of their own to have a gadget on a social website.

|> Gadget Container JavaScript:

This is a sample of core JavaScript functionality you may implement on your gadgets, and involves things like a UI layout and security.

Get Started with Shindig

To become an OpenSocial container you need to first connect the Shindig OpenSocial data server to your database and then add gadgets to your site. To add gadgets you need to do a few things. First, add some JavaScript libraries for remote procedure calls (RPC). You then need a user interface from which users can choose what gadgets to put on their page and finally add some UI elements such as a gadget gallery to your website.

A similar presentation was given at this year's Google I/O.