open social intro facebookmeetup

49

Post on 13-Sep-2014

2.802 views

Category:

Technology


1 download

DESCRIPTION

This is a presentation given to a Facebook developer's meetup on July 15th, 2008 in Santa Clara, ca.

TRANSCRIPT

Page 1: Open Social Intro Facebookmeetup
Page 2: Open Social Intro Facebookmeetup

OpenSocial Developer Update

Chris SchalkDeveloper Advocate

July 15, 2008

Page 3: Open Social Intro Facebookmeetup

3

Agenda

• Quick OpenSocial Intro

• OpenSocial API Update

• OpenSocial Container Update

• Google Friend Connect

Page 4: Open Social Intro Facebookmeetup

4

Agenda

• Quick OpenSocial Intro

• OpenSocial API Update

• OpenSocial Container Update

• Google Friend Connect

Page 5: Open Social Intro Facebookmeetup

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!

Page 6: Open Social Intro Facebookmeetup

Too many platforms!

Page 7: Open Social Intro Facebookmeetup

Standards based

OpenSocial

Write once… Deploy everywhere

Page 8: Open Social Intro Facebookmeetup

Single PlatformCooooool!

Page 9: Open Social Intro Facebookmeetup

9

A sample of OpenSocial partners

®friendster

Page 10: Open Social Intro Facebookmeetup

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

Page 11: Open Social Intro Facebookmeetup

11

OpenSocial Community

Page 12: Open Social Intro Facebookmeetup

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…

Page 13: Open Social Intro Facebookmeetup

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

Page 14: Open Social Intro Facebookmeetup

14

OpenSocial application in action

Gadget using JavaScript Client API communicates with OpenSocial server

OpenSocialServer

browser

JSON

Gadget XML SourceGadget XML Source

Page 15: Open Social Intro Facebookmeetup

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:

Page 16: Open Social Intro Facebookmeetup

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:

Page 17: Open Social Intro Facebookmeetup

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);}

Page 18: Open Social Intro Facebookmeetup

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;}

Page 19: Open Social Intro Facebookmeetup

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())}

Page 20: Open Social Intro Facebookmeetup

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);}

Page 21: Open Social Intro Facebookmeetup

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);}

Page 22: Open Social Intro Facebookmeetup

22

Agenda

• Quick OpenSocial Intro

• OpenSocial API Update

• OpenSocial Container Update

• Google Friend Connect

Page 23: Open Social Intro Facebookmeetup

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

Page 24: Open Social Intro Facebookmeetup

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?>

Page 25: Open Social Intro Facebookmeetup

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.

Page 26: Open Social Intro Facebookmeetup

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/

Page 27: Open Social Intro Facebookmeetup

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!

Page 28: Open Social Intro Facebookmeetup

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

Page 29: Open Social Intro Facebookmeetup

29

Agenda

• Quick OpenSocial Intro

• OpenSocial API Update

• OpenSocial Container Update

• Google Friend Connect

Page 30: Open Social Intro Facebookmeetup

30

• 275+ million users

• 88 million installs

OpenSocial Development

Current live OpenSocial developer sandboxes

• 2400+ apps

• 20,000+ developers

Page 31: Open Social Intro Facebookmeetup

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)

Page 32: Open Social Intro Facebookmeetup

32 32

Shindig Architecture

• Gadget Server

• OpenSocial Data Server

Yoursite.com

GadgetGadgetServer

OpenSocialDataServer

Shindig

Page 33: Open Social Intro Facebookmeetup

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…)

Page 34: Open Social Intro Facebookmeetup

34

Demonstration: Getting familiar with Shindig

Page 35: Open Social Intro Facebookmeetup

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)

Page 36: Open Social Intro Facebookmeetup

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 …

Page 37: Open Social Intro Facebookmeetup

37

Demonstration: A quick look at the REST api

Page 38: Open Social Intro Facebookmeetup

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

Page 39: Open Social Intro Facebookmeetup

39

Agenda

• Quick OpenSocial Intro

• OpenSocial API Update

• OpenSocial Container Update

• Google Friend Connect

Page 40: Open Social Intro Facebookmeetup

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!

Page 41: Open Social Intro Facebookmeetup

41

Google Friend Connect

A hosted OpenSocial container solution

Page 42: Open Social Intro Facebookmeetup

42

ingridmichaelson.com on Friend Connect

Page 43: Open Social Intro Facebookmeetup

43

My new blog on Friend Connect

Page 44: Open Social Intro Facebookmeetup

44

Demonstration: Google Friend Connect on my blog

Page 45: Open Social Intro Facebookmeetup

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/

Page 46: Open Social Intro Facebookmeetup

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

Page 47: Open Social Intro Facebookmeetup

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!"

Page 48: Open Social Intro Facebookmeetup

48

OpenSocial

Q&AI’ll upload my slides to SlideShare.NetAlso be sure to stop by: http://chrisschalk.com/blog

Page 49: Open Social Intro Facebookmeetup