Hi5 Developer Center

Upgrading Gadget Server

| | Comments (1) | TrackBacks (0)
Hi devs,

I know this is late in the game, but I plan to move to most apps in our sandbox to our new production gadget server at 6pm PT.  I will not be moving certain apps that I know have compatibility problems with this new release.

There's a lot of new good things in our new gadget server.  Here's the changelog:

Better Performance via Batched Requests

When you create a new opensocial.DataRequest() all items are submitted to the server and the results come back in one shot.  The following code will send one request to the backend that updates some app data, loads the owner/viewer/viewer friends, and loads app data for viewer and viewer_friends.  All in one request!

  var req = opensocial.newDataRequest();
  req.add(req.newUpdatePersonAppDataRequest('VIEWER', 'gifts', json));
  req.add(req.newFetchPersonRequest('VIEWER', opts), 'viewer');
  req.add(req.newFetchPersonRequest('OWNER', opts), 'owner');
  req.add(req.newFetchPeopleRequest('VIEWER_FRIENDS', opts), 'viewerFriends');
  req.add(req.newFetchPersonAppDataRequest('VIEWER', 'gifts'), 'data');
  req.add(req.newFetchPersonAppDataRequest('VIEWER_FRIENDS', 'gifts'), 'viewerFriendData');
  req.send(onLoadFriends);

Activity Feed Fetching

You can now fetch activity feed data for any set of users.

Better Support for Application Data

You app can now get application data for whole sets of user ids.

Important!  Our old version of the datarequest API had a bug with respect to the Open Social standard.  Per that standard all data is now html escaped.  If you're using JSON or other format sensitive data you should decode your data like this:

        var json = gadgets.util.unescapeString(data[person.getId()]['gifts']);

New methods for getting User Presence and Online Status

We previously had published a way of retrieving hi5 presence and status data via custom APIs.  We've changed this so that you can get this information in any fetchPersonRequest/fetchPeopleRequest call.  The new way of retrieving this data is to pass in a valid list of PROFILE_DETAILS.  Here's a sample:

  var opts = {};

  opts[opensocial.DataRequest.PeopleRequestFields.PROFILE_DETAILS] =
                     [opensocial.Person.Field.AGE,
                     opensocial.Person.Field.NAME,
                     opensocial.Person.Field.GENDER,
                     opensocial.Person.Field.PROFILE_URL,
                     opensocial.Person.Field.THUMBNAIL_URL,
                     opensocial.Person.Field.STATUS,
                     hi5.PersonField.PRESENCE
   ];

  var req = opensocial.newDataRequest();
  req.add(req.newFetchPersonRequest('VIEWER', opts), 'viewer');
  .....

In your callback you can get at this data in the following way:

  var status = viewer.getField(opensocial.Person.Field.STATUS);
  var presence = viewer.getField(hi5.PersonField.PRESENCE);


Albums Support

This current build does not support fetching albums.  We will add this feature in before monday.

Signed Requests

You can now make requests to your backend server with SIGNED requests.  Adding this to your application means that you can be assured that data has not been spoofed or tampered.  Here's a simple example of using signed requests:

              gadgets.io.makeRequest("http://www.inuus.com/os/testOauth.php", function(r) { alert(response.text);},
                 {CONTENT_TYPE: gadgets.io.ContentType.JSON, 
                  METHOD: "POST",
                  POST_DATA: "message=moooooo",
                  AUTHORIZATION: gadgets.io.AuthorizationType.SIGNED});

You can use an OAuth compatible library to verify the requests are correct.  We have one available here:

http://www.hi5networks.com/platform/browser/sampleapps/

The hi5modules.com public certificate can be downloaded here:

http://www.a.hi5modules.com/hi5modules.com.cert



0 TrackBacks

Listed below are links to blogs that reference this entry: Upgrading Gadget Server.

TrackBack URL for this entry: http://www.hi5networks.com/cgi-bin/mt/mt-tb.cgi/96

1 Comments

Great update and nice to have the signed request feature !

About moving apps from sandbox to production server, how can we know that our app is moving and not have "compatibility problems with this new release." ?

Thanks for the information
Victor

Leave a comment

© 2008 hi5Networks