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.
15. 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
16. How do we socialize objects
online
without having to create yet
another social network?
17.
18.
19.
20.
21. Standards create markets: Hal Varian
OpenSocial is a straightforward application of chapters 8 and 9 of his
1998 book quot;Information Rulesquot;
“Standards change competition for a market to competition within a
market”
Network Effects
Lock-In and Switching Costs
Standards
23. OpenSocial Foundation
OpenSocial Foundation
http://opensocial.org/
Keep the specification open
Specifications discussed in public forum
Spec evolves using an open source community process
27. Why should you care about OpenSocial?
Developers: Distribution >275 Million users
Containers: Features
Users: More applications
28. This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License
29. This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License
30. This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License
31. A standard for everyone
This work by Eliette Chanezon is licensed under a Creative Commons Attribution-Share Alike 3.0 License
32. How To Build OpenSocial Applications -
Chris Schalk
33. OpenSocial Client API
JavaScript - version 0.7 production
Standard Web development technologies
HTML + Javascript
Can integrate with 3rd party server
REST Services
Based on Atom publishing protocol
AtomPub and JSON
34. OpenSocial JavaScript API
The core OpenSocial Services include
People & Friends
Access friends information programmatically
Activities
See what you’re friends are up to
Share what you are doing
Persistence
Provide state without a server
Share data with your friends
35. People & Friends Example
Requesting friend Info
function getFriendData() {
var req = opensocial.newDataRequest();
req.add(req.newFetchPersonRequest(VIEWER),
'viewer');
req.add(req.newFetchPeopleRequest(VIEWER_FRIENDS),
'viewerFriends');
req.send(onLoadFriends);
}
36. People & Friends Example
Callback function for returned friend data
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;
}
37. Activities Example
Posting an activity
function postActivity(text) {
var params = {};
params[opensocial.Activity.Field.TITLE] = text;
var activity = opensocial.newActivity(params);
opensocial.requestCreateActivity(activity,
opensocial.CreateActivityPriority.HIGH, callback);
}
postActivity(quot;This is a sample activity, created at quot; +
new Date().toString())
}
38. Persistence Example
Persisting data
function populateMyAppData() {
var req = opensocial.newDataRequest();
var data1 = Math.random() * 5;
var data2 = Math.random() * 100;
req.add(req.newUpdatePersonAppDataRequest(quot;VIEWERquot;,
quot;AppField1quot;, data1));
req.add(req.newUpdatePersonAppDataRequest(quot;VIEWERquot;,
quot;AppField2quot;, data2));
req.send(requestMyData);
}
39. Persistence Example
Fetching persisted data
function requestMyData() {
var req = opensocial.newDataRequest();
var fields = [quot;AppField1quot;, quot;AppField2quot;];
req.add(req.newFetchPersonRequest(
opensocial.DataRequest.PersonId.VIEWER), quot;viewerquot;);
req.add(req.newFetchPersonAppDataRequest(quot;VIEWERquot;,
fields), quot;viewer_dataquot;);
req.send(handleReturnedData);
}
40. Persistence Example
Displaying fetched (persisted) data
function handleReturnedData(data) {
var mydata = data.get(quot;viewer_dataquot;);
var viewer = data.get(quot;viewerquot;);
me = viewer.getData(); // me is global var
var data = mydata[me.getId()];
htmlout += quot;AppField1: quot; + data[quot;AppField1quot;] + quot;<br/>quot;;
htmlout += quot;AppField2: quot; + data[quot;AppField2quot;] + quot;<br/>quot;;
var div = document.getElementById('content_div');
div.innerHTML = htmlout;
}
42. Server-side REST Services
Accessing People information
/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
43. Server-side REST Services
Accessing Activities information
/activities/{guid}/@self
-- Collection of activities generated by given user
/activities/{guid}/@friends
-- Collection of activities for friends of the given user
{guid}
44. Server-side REST Services
Accessing Persistent data
/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
45. Server-side REST Services
Additional query parameters
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
47. OpenSocial ServerSide Integration Options
In addition to using the provided persistence API...
Establish a quot;homequot; site where gadget can phone
home to retrieve, post data
Can host home site on your own, or use services:
Amazon EC2
Joyent
Google AppEngine
48. Google AppEngine and OpenSocial
Create an App Engine app as your backend!
Use makeRequest() to call back to your AppEngine
server
Utilize AppEngine's datastore
New OpenSocial Apps are coming online
BuddyPoke...
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
51. Containers provide a social context
OpenSocial separates application logic from social context
an app sees user ids - the container makes them people
Users understand the social contract of the containers
Save apps and users from re-registration hell
52. Containers don’t choose users
Containers set up the social model, users choose to join
they grow through homophily and affinity
Network effect can bring unexpected userbases
53. OpenSocial gets you to all their users
You don't have to pick a site to specialise for
You get to spread through multiple friend groups
You'll be surprised by where your users are
so make sure you plan to localize
54. Not just Social Network Sites
Social network sites - Profiles and home pages
Personal dashboards
Sites based around a Social Object
Corporate CRM systems
Any web site
How do we abstract these out?
Viewer + friends
Owner + friends
57. Owner and Viewer
are defined by Container
The Application gets IDs and connections to other IDs
58. the Owner need not be a Person
It could be an organisation
or a social object
59. Kinds of container - Social network
sites
Profile pages
Owner is profile page owner
Viewer may not be known, may be owner or other
member
Home pages
Owner is Viewer (must be logged in to see)
Examples
MySpace
Hi5
Orkut
60. Kinds of container - Personal
dashboard
like Home pages
Owner is Viewer (must be logged in to see)
Friends may not be defined
Example:
iGoogle, My Yahoo
61. Kinds of container - Social Object site
Pages reflect the object - movie, picture, product
Owner is the object
Owner friends are people connected to the object
may be authors or fans
Viewer 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
62. Kinds of container - CRM systems
Pages reflect the customer
Owner is the customer
Owner friends are people connected to the customer
may be your colleagues, or other customers
Viewer is you, Viewer friends are your colleagues or
customers
Example:
Oracle CRM, Salesforce
63. Kinds of container - Any web site
Owner is the site
Owner friends are site users
Viewer is you,
Viewer friends are your friends who have visited this site
Example:
Google Friend Connect will enable this for any site
64. Container Sites control policy
Check the Environment
Getting information
Viewer information may not be available
or it may be hidden from you
Call requestPermission API that can prompt the users
Spreading your application
Activities display under container control
RequestSendMessage
RequestShareApp
Monetization and Installation
Meet the Containers (next session)
Best Practices for Spreading your App (tomorrow)
67. 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!
68. 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 workquot;
71. SocialSite
SocialSite is an Open Source project that allows you to turn
your web application in an OpenSocial container
Leverages Apache Shindig
Built by Sun (Dave quot;Rollerquot; Johnson), announced at
JavaOne this month
Adds a database and widgets to manage your social
network
73. Summary
OpenSocial is making the web more social
The current version 0.7 is in production
REST API and 0.8 coming soon
Developers can start creating social applications today
Orkut, Myspace, hi5, Netlog open to 200 M users now
iGoogle, IDTail, Hyves, Imeem sandboxes
Social sites: implement OpenSocial
get Shindig and start planning
SocialSite
Friend Connect
Advertisers: create brand advertising Apps now
74. OpenSocial Sessions at Google I/O
12 sessions
Building an OpenSocial Application, Focus on Client Side APIs
Apache Shindig: Make Your Social Site an OpenSocial Container
OpenSocial - Scaling and Analytics, Nuts & Bolts
URLs Are People Too - Using the Social Graph API to Build a Social Web
Fireside Chat: OpenSocial
OpenSocial at MySpace: Creating popular apps on MySpace
OpenSocial across Containers
OpenSocial Specification: What's Next for OpenSocial
Monetizing Application Traffic On Social Network
OpenSocial, OpenID, and OAuth: Oh, My!
Best Practices for Spreading Your App without Ruining the User
Experience
Building on the Promise of OpenSocial
2 code labs
Make Your Social Site an OpenSocial Container Using Shindig
Building an OpenSocial Application in the Cloud