View
2.802
Download
1
Embed Size (px)
DESCRIPTION
This is a presentation given to a Facebook developer's meetup on July 15th, 2008 in Santa Clara, ca.
Citation preview
OpenSocial Developer Update
Chris SchalkDeveloper Advocate
July 15, 2008
3
Agenda
• Quick OpenSocial Intro
• OpenSocial API Update
• OpenSocial Container Update
• Google Friend Connect
4
Agenda
• Quick OpenSocial Intro
• OpenSocial API Update
• OpenSocial Container Update
• Google Friend Connect
5
OpenSocial High Level Details
• A set of APIs that operate in standard Webtechnologies
• HTML, JavaScript, CSS, Ajax, REST …)
• A reference Implementation: Shindig• Apache Open Source Project• Java or PHP
• Multiple OpenSocial “container” partners• hi5, MySpace, orkut, imeem, iGoogle …
• A huge community of developers• Even bigger community of users!
Too many platforms!
Standards based
OpenSocial
Write once… Deploy everywhere
Single PlatformCooooool!
9
A sample of OpenSocial partners
®friendster
10
OpenSocial Numbers
• 260 days old
• 275,000,000+ users
• 66,000,000+ installs
• 2,000+ apps
• 20,000+ developers
• 10,000,000 daily app users
11
OpenSocial Community
12
OpenSocial Client APIs - A Quick Refresher
• JavaScript API - for browser based client development• Standard Web development technologies
• HTML + Javascript, CSS, AJAX
• Can integrate with 3rd party servers• PHP, Python, Perl, Java, C/C++
• RESTful API - for server based client development• Based on Atom publishing protocol• Data transfer is Atom or JSON• More on RESTful API later…
13
JavaScript OpenSocial Applications = “gadgets++”
• If you know how to develop gadgets, you know how todevelop JavaScript OpenSocial applications!
• Follows same approach as gadgets• JavaScript/HTML/CSS embedded in an XML
document• XML document containing gadget is hosted on the
Internet• OpenSocial applications are “gadgets++”
• Gadgets development, but with additional Socialcapabilities
14
OpenSocial application in action
Gadget using JavaScript Client API communicates with OpenSocial server
OpenSocialServer
browser
JSON
Gadget XML SourceGadget XML Source
15
Understanding the OpenSocial JavaScript API
• 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
The core OpenSocial services:
16
OpenSocial JavaScript APIs overview
• Gadgets Core Utilities handling gadget preferences, IO, JSON
• Gadgets Feature-Specific Utilities for working with flash, window management,tabs, rpc, MiniMessage
Additional Gadgets services:
17
People & Friends Example
An example JavaScript function to request viewer andfriends info
function getFriendData() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest(VIEWER),'viewer'); req.add(req.newFetchPeopleRequest(VIEWER_FRIENDS), 'viewerFriends'); req.send(onLoadFriends);}
18
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;}
19
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("This is a sample activity, created at " + new Date().toString())}
20
Persistence Example
Storing persisted data
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);}
21
Persistence Example
Fetching persisted data
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);}
22
Agenda
• Quick OpenSocial Intro
• OpenSocial API Update
• OpenSocial Container Update
• Google Friend Connect
23
OpenSocial v0.8 has been defined!
• Latest evolution of OpenSocial as defined by theOpenSocial development community
• Updated JavaScript API• Now contains a RESTful API!
• Shindig supports v0.8 today!• hi5 almost done with their support• orkut currently working on their implementation• Other containers also working on 0.8
• Specification is here:http://www.opensocial.org/Technical-Resources/opensocial-spec-v08
24
OpenSocial v0.8 REST API
• Access OpenSocial data without JavaScript
– Use simple REST calls instead
– Does not require gadget container
– Allows server-to-server communication
• Client libraries under development (open source):
– Java
– PHP
– Python
– <your favorite language here?>
25
0.8 Compatibility and Migration
• Most containers will continue to support 0.7 apps with nochanges.
• Most 0.8 changes are backwards compatible.
• To use new 0.8 features, you might have to update smallamounts of existing 0.7 app code.
26
Beyond 0.8 - OpenSocial Templating Proposal
• Goal:
– Enable a faster development experience that is both secure andefficient
Core principles:
• Client-side and server-side processing
• Standard set of tags with extensibility model
– Example: <os:ShowPerson>
• http://groups.google.com/group/opensocial-and-gadgets-spec/web/opensocial-templates
– Demo: http://ostemplates-demo.appspot.com/
27
To follow the progress of the Spec…
http://groups.google.com/group/opensocial-and-gadgets-spec
Don’t worry, I’ll share the slides with you!
28
Additional OpenSocial application development resources
• OpenSocial documentation, FAQ, Blog
• http://code.google.com/opensocial
• Further development resources
• http://code.google.com/p/opensocial-resources
• Development sandboxes available for:
• orkut, hi5, MySpace, imeem, Netlog
29
Agenda
• Quick OpenSocial Intro
• OpenSocial API Update
• OpenSocial Container Update
• Google Friend Connect
30
• 275+ million users
• 88 million installs
OpenSocial Development
Current live OpenSocial developer sandboxes
• 2400+ apps
• 20,000+ developers
31
Download your own “Container” - Shindig
• OpenSocial Reference Implementation
• Parallels versions in Java and PHP
• More languages to come…
• Can use as your own “sandbox” for testing or can
build your own social network site
• Shindig Contains• Gadget Server
– Renders gadget XML as HTML/JS/CSS
• OpenSocial Data Server– RESTful API server (in-progress)
32 32
Shindig Architecture
• Gadget Server
• OpenSocial Data Server
Yoursite.com
GadgetGadgetServer
OpenSocialDataServer
Shindig
33
Shindig Details
• Strong open source community
• High quality production-ready code
• Update easily as OpenSocial evolves
• Built in security using OAuth
• Fully compliant with OpenSocial v0.7 and v0.8
• Shindig is language neutral(Java, PHP today, more to follow…)
34
Demonstration: Getting familiar with Shindig
35
Interacting with the REST API using Shindig
• Use simple REST calls instead!
– Does not require JavaScript
– Allows server-to-server communication
• Easily integrate with other server-side technologies:Java, PHP, Perl
Question: Why would you need a RESTful API?
Answer: What if you wanted to access OpenSocial data from a server? (Outside of a browser/JavaScript environment)
36 36
Shindig REST Architecture
• Gadget Server
• OpenSocial Data Server
• REST Server (in progress)
Yoursite.comGadget Server
OpenSocialDataServer
Shindig
OpenSocialREST Server
JSON or ATOM
REST
Java | PHP | Python C++ | Perl …
37
Demonstration: A quick look at the REST api
38
Shindig success at hi5
• Big Traffic
• 10k req/sec Edge
• 6k req/sec Origin
• Hundreds of Developers
• 800+ Apps
• 1 Billion hits/day
… on 40 Shindig servers
38
39
Agenda
• Quick OpenSocial Intro
• OpenSocial API Update
• OpenSocial Container Update
• Google Friend Connect
40
Google Friend Connect
• Personal Web sites (e.g.blogs) have readers, contacts,
connections for a social graph
• Can small personal websites host OpenSocial
applications?
Problem: blogger’s/Webmasters typically lack
development resources!
Solution: Google Friend Connect solves this problem!
41
Google Friend Connect
A hosted OpenSocial container solution
42
ingridmichaelson.com on Friend Connect
43
My new blog on Friend Connect
44
Demonstration: Google Friend Connect on my blog
45
Google Friend Connect
•Users• … more ways to do more things with my friends
•Site owners•… more (and more engaged) traffic for my site
•App developers•... more reach for my apps
• Sign up for the preview release!
http://google.com/friendconnect/
46
Get Involved!
Homepage & specification:• http://www.opensocial.org
Get on the forums:• http://groups.google.com/group/opensocial
Subscribe to the Shindig mailing list:• [email protected]
Help shape the specification:• http://groups.google.com/group/opensocial-and-gadgets-spec/
Templates:• http://groups.google.com/group/opensocial-and-gadgets-spec/web/opensocial-templates
Check out Shindig:• http://incubator.apache.org/shindig
47
Some parting words from Jia Shen
Founder of RockYou…
"OpenSocial has allowed a vast number of social networks to open up sooner and faster than if they did it on their own. “
“It has allowed us to build on a single code base and deploy it on an ever growing list of platforms with great ease!"
48
OpenSocial
Q&AI’ll upload my slides to SlideShare.NetAlso be sure to stop by: http://chrisschalk.com/blog