Google IO 2008 - Opensocial, a Standard for the Social Web

Post on 13-Sep-2014

25.619 views 1 download

Tags:

description

OpenSocial is an open specification defining a common API that works on many different social websites, including MySpace, Plaxo, Hi5, Ning, orkut, Salesforce.com and LinkedIn, among others. This allows developers to learn one API, then write a social application for any of those sites: Learn once, write anywhere. In addition, in order to make it easier for developers of social sites to implement the API and make their site an OpenSocial container, the Apache project Shindig provides reference implementations for OpenSocial containers in two languages (Java, PHP). Shindig will define a language specific Service Provider Interface (SPI) that a social site can implement to connect Shindig to People, Persistence and Activities backend services for the social site. Shindig will then expose these services as OpenSocial JavaScript and REST APIs. In this session we will explain what OpenSocial is, show examples of OpenSocial containers and applications, demonstrate how to create an OpenSocial application, and explain how to leverage Apache Shindig in order to implement an OpenSocial container.

Transcript of Google IO 2008 - Opensocial, a Standard for the Social Web

OpenSocial: A Standard for the Social Web

Patrick ChanezonKevin MarksChristian Schalk

May 28, 2008

Agenda

OpenSocial Introduction

How to build OpenSocial Applications

OpenSocial Containers

Becoming an OpenSocial container

Summary

OpenSocial Introduction - Patrick Chanezon

Making the web betterby making it social

What does social mean?

What does Social mean?

Eliette what do you do with your friends?

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

Raoul: a social object for Charlotte (3 year old)

Jaiku’s Jyri Engeström's 5 rules for social networks: social objects

1. What is your object?2. What are your verbs?3. How can people share the objects? 4. What is the gift in the invitation?5. Are you charging the publishers or the spectators?http://tinyurl.com/yus8gw

How do we socialize objects online

without having to create yet another social network?

Standards create markets: Hal Varian

OpenSocial is a straightforward application of chapters 8 and 9 of his 1998 book "Information Rules"“Standards change competition for a market to competition within a market”

Network EffectsLock-In and Switching CostsStandards

OpenSocial

A common API for social applications across multiple web sites

OpenSocial Foundation

OpenSocial Foundationhttp://opensocial.org/Keep the specification open

Specifications discussed in public forumSpec evolves using an open source community process

friendster®

OpenSocial Containers

Standards-based

html+javascript+REST+oauth

Why should you care about OpenSocial?

Developers: Distribution >275 Million users

Containers: Features

Users: More applications

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

A standard for everyone

This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License

How To Build OpenSocial Applications - Chris Schalk

OpenSocial Client API

JavaScript - version 0.7 productionStandard Web development technologies

HTML + JavascriptCan integrate with 3rd party server

REST ServicesBased on Atom publishing protocolAtomPub and JSON

OpenSocial JavaScript API

People & Friends Access friends information programmatically

ActivitiesSee what you’re friends are up toShare what you are doing

PersistenceProvide state without a serverShare data with your friends

The core OpenSocial Services include

People & Friends ExampleRequesting friend Info

function getFriendData() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest(VIEWER), 'viewer'); req.add(req.newFetchPeopleRequest(VIEWER_FRIENDS), 'viewerFriends'); req.send(onLoadFriends);}

People & Friends Example

function onLoadFriends(resp) { var viewer = resp.get('viewer').getData(); var viewerFriends = resp.get('viewerFriends').getData(); var html = 'Friends of ' + viewer.getDisplayName() + ‘:<br><ul>’; viewerFriends.each(function(person) { html += '<li>' + person.getDisplayName()+'</li>';}); html += '</ul>'; document.getElementById('friends').innerHTML = html;}

Callback function for returned friend data

Activities Example

function postActivity(text) { var params = {}; params[opensocial.Activity.Field.TITLE] = text; var activity = opensocial.newActivity(params); opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH, callback);}postActivity("This is a sample activity, created at " + new Date().toString())}

Posting an activity

Persistence Example

function populateMyAppData() { var req = opensocial.newDataRequest(); var data1 = Math.random() * 5; var data2 = Math.random() * 100;

req.add(req.newUpdatePersonAppDataRequest("VIEWER", "AppField1", data1)); req.add(req.newUpdatePersonAppDataRequest("VIEWER", "AppField2", data2)); req.send(requestMyData);}

Persisting data

Persistence Example

function requestMyData() { var req = opensocial.newDataRequest(); var fields = ["AppField1", "AppField2"];

req.add(req.newFetchPersonRequest( opensocial.DataRequest.PersonId.VIEWER), "viewer"); req.add(req.newFetchPersonAppDataRequest("VIEWER", fields), "viewer_data"); req.send(handleReturnedData);}

Fetching persisted data

Persistence Example

function handleReturnedData(data) { var mydata = data.get("viewer_data"); var viewer = data.get("viewer"); me = viewer.getData(); // me is global var var data = mydata[me.getId()];

htmlout += "AppField1: " + data["AppField1"] + "<br/>"; htmlout += "AppField2: " + data["AppField2"] + "<br/>"; var div = document.getElementById('content_div'); div.innerHTML = htmlout;}

Displaying fetched (persisted) data

Demonstration - Building OpenSocial Applications using the JavaScript API

Server-side REST Services

/people/{guid}/@all -- Collection of all people connected to user {guid}

/people/{guid}/@friends -- Collection of all friends of user {guid} -- subset of @all

/people/{guid}/@self -- Profile record for user {guid}

/people/@me/@self -- Profile record for requestor

Accessing People information

Server-side REST Services

/activities/{guid}/@self -- Collection of activities generated by given user

/activities/{guid}/@friends -- Collection of activities for friends of the given user {guid}

Accessing Activities information

Server-side REST Services

/appdata/{guid}/@self/{appid} -- All data for user {guid}, app {appid}

/appdata/{guid}/@friends/{appid} -- All data for friends of user {guid} and app {appid}; read-only

Accessing Persistent data

Server-side REST Services

format={format} -- Format desired; one of (atom, json); default is json fields={field+} -- List of fields to include in request

startPage={startPage} -- Index into a paged collection

count={count} -- Set page size for paged collection

Additional query parameters

Demonstration - Using the OpenSocial REST Services

OpenSocial ServerSide Integration Options

Establish a "home" site where gadget can phone home to retrieve, post data

Can host home site on your own, or use services:Amazon EC2JoyentGoogle AppEngine

In addition to using the provided persistence API...

Google AppEngine and OpenSocial

Create an App Engine app as your backend!Use makeRequest() to call back to your AppEngine serverUtilize AppEngine's datastore

New OpenSocial Apps are coming onlineBuddyPoke...

Checkout Lane Liabraaten’s OpenSocial-AppEngine integration article

http://code.google.com/apis/opensocial/articles/appengine.html

Google IO Code Lab about OpenSocial Apps in the Cloud

Resources For Application DevelopersSpecificationhttp://opensocial.org/http://groups.google.com/group/opensocial-and-gadgets-spec

Code Samples and Toolshttp://code.google.com/opensocialhttp://code.google.com/p/opensocial-resources/

Sandboxeshttp://developer.myspace.com/http://www.hi5networks.com/developer/http://opensocial.ning.com/http://code.google.com/apis/orkut/http://code.google.com/apis/igoogle/http://en.netlog.com/go/developer/opensocial

OpenSocial Containers - Kevin Marks

Containers provide a social context

OpenSocial separates application logic from social contextan app sees user ids - the container makes them peopleUsers understand the social contract of the containersSave apps and users from re-registration hell

Containers don’t choose users

Containers set up the social model, users choose to jointhey grow through homophily and affinityNetwork effect can bring unexpected userbases

OpenSocial gets you to all their users

You don't have to pick a site to specialise forYou get to spread through multiple friend groupsYou'll be surprised by where your users areso make sure you plan to localize

Not just Social Network Sites

Social network sites - Profiles and home pagesPersonal dashboardsSites based around a Social ObjectCorporate CRM systemsAny web site

How do we abstract these out?

Viewer + friendsOwner + friends

The Viewer and Viewer friends

Owner and Owner friends

Owner and Viewerare defined by Container

The Application gets IDs and connections to other IDs

the Owner need not be a PersonIt could be an organisation

or a social object

Kinds of container - Social network sites

Profile pagesOwner is profile page ownerViewer may not be known, may be owner or other member

Home pagesOwner is Viewer (must be logged in to see)

ExamplesMySpaceHi5Orkut

Kinds of container - Personal dashboard

like Home pagesOwner is Viewer (must be logged in to see)

Friends may not be definedExample:

iGoogle, My Yahoo

Kinds of container - Social Object site

Pages reflect the object - movie, picture, productOwner is the objectOwner friends are people connected to the object

may be authors or fansViewer is looking at it, Viewer friends are people you may want to share with

Example:Imeem is a bit like this - opportunity for sites like Flickr, YouTube

Kinds of container - CRM systems

Pages reflect the customer Owner is the customerOwner friends are people connected to the customer

may be your colleagues, or other customersViewer is you, Viewer friends are your colleagues or customers

Example:Oracle CRM, Salesforce

Kinds of container - Any web site

Owner is the site

Owner friends are site usersViewer is you,

Viewer friends are your friends who have visited this siteExample:

Google Friend Connect will enable this for any site

Container Sites control policy

Check the EnvironmentGetting information

Viewer information may not be availableor it may be hidden from youCall requestPermission API that can prompt the users

Spreading your applicationActivities display under container controlRequestSendMessageRequestShareApp

Monetization and Installation

Meet the Containers (next session)Best Practices for Spreading your App (tomorrow)

Netlog demo

Becoming an Open Social Container - Chris Schalk

Becoming an OpenSocial Container

Question: How do you become an OpenSocial container?

Answer: Utilize existing Open Source container code.

The Apache incubator project “Shindig” serves this purpose!

Apache Shindig

What is Shindig?Open source software that allows you to host OpenSocial applications

Is currently an Apache Software Incubator project Heavy partner involvement (Ning, hi5 …) Serves as open source reference implementation of OpenSocial & gadgets technologies

It’s Goal: “Shindig's goal is to allow new sites to start hosting social apps in well under an hour's worth of work"

Apache Shindig Info...Apache Shindig Website

http://incubator.apache.org/shindig

Demonstration - Implementing your own container using Shindig

SocialSiteSocialSite is an Open Source project that allows you to turn your web application in an OpenSocial containerLeverages Apache ShindigBuilt by Sun (Dave "Roller" Johnson), announced at JavaOne this monthAdds a database and widgets to manage your social network

SocialSite Architecture

Details at https://socialsite.dev.java.net/

SummaryOpenSocial is making the web more socialThe current version 0.7 is in production

REST API and 0.8 coming soon

Developers can start creating social applications todayOrkut, Myspace, hi5, Netlog open to 200 M users nowiGoogle, IDTail, Hyves, Imeem sandboxes

Social sites: implement OpenSocial get Shindig and start planningSocialSiteFriend Connect

Advertisers: create brand advertising Apps now

OpenSocial Sessions at Google I/O12 sessions

Building an OpenSocial Application, Focus on Client Side APIsApache Shindig: Make Your Social Site an OpenSocial ContainerOpenSocial - Scaling and Analytics, Nuts & BoltsURLs Are People Too - Using the Social Graph API to Build a Social WebFireside Chat: OpenSocialOpenSocial at MySpace: Creating popular apps on MySpaceOpenSocial across ContainersOpenSocial Specification: What's Next for OpenSocialMonetizing Application Traffic On Social NetworkOpenSocial, OpenID, and OAuth: Oh, My!Best Practices for Spreading Your App without Ruining the User ExperienceBuilding on the Promise of OpenSocial

2 code labsMake Your Social Site an OpenSocial Container Using ShindigBuilding an OpenSocial Application in the Cloud

Q & A