How the opensocial Gadget request works on Wave

Yesterday we had a problem with development of a gadget.

From the gadget we wanted to query a backend server running Ruby On rails. We used Json in the request, which is fairly easy to implement in Ruby and Javascript. The scenario looked like the following.


We used the code which looked like the following example, which exist on the page Working with Remote Gadgets.

 function makeJSONRequest() {
      var params = {};
      params[] =;
      // This URL returns a JSON-encoded string that represents a JavaScript object
      var url = "";, response, params);

We had also added some of the authentication types, because we thought a problem was the authentication. Somehow the request did not get the correct response back. So we had to lookinto how the gadget workes.

My thought was the gadget just called the webserver directly. We did intercept the Gadget calls using the Live HTTP Client for Firefox. When we used it there was a call to The gadgets are also hosted on this site and there are other numbers where the content is hosted.

The request looked like the following instead.


So all requests to the remote server is done via the googleusercontent, which gives some advantages.

  • Using the opensocial authentication you do not need the users to login to your applications. Authentication can be done by trusting Oauth or the opensocial content (I have not research it fully yet).
  • Building an Appstore will be much easier. When you look at the code there are links to where the gadgets exists. So you could just copy the link to the XML code and then start using it. When all the gadgets have to be displayed from the servers, Google has the option of allowing certain url only to be exposed to the individuals how has paid for the service.
  • All data is cached the servers, meaning that you will get fewer requests and less load on your sever.  You can bypass the caching by following this guide.

So we learned a great deal about the architecture on this problem. Our next challange is to figure out how we can leverage the Opensocial authentication to authenticate the users on our Ruby on Rails application. If you have any pointers please let us know.

Bookmark and Share

Published by


Daniel Graversen

Founder of and SAP Integration consultant at

Leave a Reply

Your email address will not be published. Required fields are marked *