The document provides an overview of OpenSocial, including its history and concepts, building OpenSocial applications, hosting OpenSocial applications, and upcoming updates. Some key points include:
- OpenSocial allows applications to access social features and data from containers like social networks.
- Gadgets are the basic building block for OpenSocial applications and are defined using XML specs.
- Shindig is an open source reference implementation that can be used to host and serve OpenSocial applications.
- The OpenSocial specification continues to evolve with new versions adding features like REST/RPC APIs and support for dynamic HTML from external servers.
4. OpenSocial Roadmap
• Version 0.5 was released in a “developer release” on Nov
1st.
• First “sandbox” was made available on Orkut
• Version 0.6 was released in December
• Initial version of Shindig server software was launched as Apache
incubator project
• Other sandboxes came live - Hi5, Ning, Plaxo …
• Version 0.7 (production) was released in January
• MySpace, Hi5, Orkut began running 0.7
4
5. OpenSocial Roadmap
• Version v0.8 (0.8.1) is current
• Latest evolution of OpenSocial as defined by the
OpenSocial development community
• Updated JavaScript API
• Now contains a RESTful protocol, RPC protocol
• hi5, MySpace, orkut, iGoogle now support 0.8
• Specification:
http://www.opensocial.org/Technical-Resources/opensocial-spec-v081
5
6. OpenSocial 0.9 - Coming Soon!
• Goal:
– Enable a faster development experience that is both secure and
efficient
Core principles:
• Client-side and server-side processing
• Standard set of tags with extensibility model
– Example: <os:ShowPerson>
• More 0.9 later….
6
7. OpenSocial Concepts - What is a Container?
An OpenSocial “Container” is a website that can host
OpenSocial applications
• Is an SNS that supports OpenSocial
• Can serve Gadgets/OpenSocial Applications
• Provides end user social experience
• Provides access to site’s social graph through applications
7
8. OpenSocial Concepts - What is an Application?
An “OpenSocial Application” is a gadget that uses social
features
• OpenSocial applications are gadgets that support the OpenSocial
JavaScript APIs
• Similar to traditional gadget
• Encapsulated in an XML document
• Container fetches XML document, parses content, serves rendered
HTML/JS/CSS content in an iFrame
• OpenSocial applications can rely on third party services
8
10. Gadgets Basics
A gadget spec:
• Is an XML file.
• Defines metadata about an OpenSocial app.
• Is highly cacheable and does not need a high performance server.
Gadgets use existing web standards
• XML to define metadata.
• HTML for markup.
• JavaScript for interactivity.
• CSS for presentation.
10
11. Gadgets Basics
A gadget server:
•Takes the gadget spec as input.
•Performs optimizations on the gadget spec.
•Outputs HTML, JavaScript, and CSS as one document.
11
12. Gadgets Basics
A container:
•Displays the social network’s user interface.
•Opens an IFrame to the rendered gadget.
Containers and gadget
servers are both run by
the social network, but
do not need to be on
the same machine, or
even domain.
12
13. Gadgets Basics
Example gadget XML spec:
•Uses HTML to print “Hello World”.
•Colors the text red with CSS.
•Dynamically adjusts the height of the gadget with JavaScript.
<?xml version=quot;1.0quot; encoding=quot;UTF-8quot; ?>
<Module>
<ModulePrefs title=quot;Hello World!quot;>
<Require feature=quot;dynamic-heightquot; />
</ModulePrefs>
<Content type=quot;htmlquot;>
<![CDATA[
<h1>Hello World</h1>
<style type=quot;text/cssquot;>
h1 { color: #dd0000; }
</style>
<script type=quot;text/javascriptquot;>
gadgets.window.adjustHeight();
</script>
]]>
</Content>
</Module>
13
15. Making Gadgets Social
Gadgets can become social with OpenSocial JavaScript API
OpenSocial API has three core services:
•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
15
16. Integrating OpenSocial applications with external servers
The OpenSocial persistence service provides a way to
store/share small amounts of data on the OpenSocial
server, but…
• What if you need to store more data than your
container allows?
• Solution: You can make independent requests out
to external servers.
• Use: gadgets.io.makeRequest
• Can also make authenticated requests using Oauth
• Can use cloud services from: Joyent, Amazon or
AppEngine!
16
17. Integrating OpenSocial applications with external servers
An example request to an external server
gadgets.io.makeRequest
OpenSocial
Server External
1 2 Server
browser
1. Initial request made from gadget
2. Server routes request to external server
Requests can be secured using OAuth
17
18. Advanced OpenSocial App Development
Arne will provide more detailed coverage on OpenSocial
Application Development at 3:00pm!
18
19. Demonstration
• Building simple OpenSocial Client Applications
19
21. How to host OpenSocial Applications
1. Can build your own server that implements
OpenSocial specification…
2. Or can use “Shindig” - Reference implementation for
OpenSocial
21
22. Hosting OpenSocial Applications
What is Shindig?
• Gadget Server
–Parses gadget XML, renders as HTML/JS/CSS
• OpenSocial Data Server
–Includes RESTful API server
• Container JavaScript
–Core gadgets, OpenSocial JavaScript environment
http://incubator.apache.org/shindig
22
23. How Shindig works
• Gadget Server
• OpenSocial Data Server
Yoursite.com Shindig
Gadget
Server
Gadget
OpenSocial
DataServer
23 23
24. Why use Shindig?
• Strong Open Source community
• High quality production-ready code
• Synchronized with specification
• Language neutral (Java, PHP, …)
24
25. Shindig success at hi5
• Big Traffic
• 10k req/sec Edge
• 6k req/sec Origin
• Hundreds of Developers
• 1800+ Apps
• 1 Billion hits/day
… on 42 Shindig servers
25 25
27. Adapting Shindig
• Adapting Shindig to your own social data
Shindig
Gadget Server
OpenSocialDataServer
ActivityService Social Graph
PersonService Data
AppDataService
27
29. RESTful and RPC protocols
Opens new development models
• Background processing.
• Easier Flash integration.
• Mobile applications.
29
30. RESTful and RPC protocols
Communication methods:
•RESTful (Representational State Transfer)
•RPC (Remote Procedure Call)
Formats:
•XML
•JSON
•AtomPub
30
31. RESTful and RPC protocols
REST:
•Resources are URLs.
Example - People:
• All people connected to the given user:
/people/{guid}/@all
• All friends of the given user:
/people/{guid}/@friends
• Profile of the given user:
/people/{guid}/@self
• Profile of the authenticated user:
/people/@me/@self
• Supported Person fields:
/people/@supportedFields
31
35. RESTful and RPC protocols
REST has some disadvantages:
•Batch support requires multiple HTTP requests, or a contrived URL
scheme.
•Specifying multiple users via querystring is difficult. Is
?uid=1234,5678 the same resource as ?uid=5678,1234 ?
35
37. RESTful and RPC protocols
Client libraries are being created for PHP, Java, and Python.
• Help you connect to OpenSocial containers, and work with social
data on your server.
Sample: log into a container:
37
38. RESTful and RPC protocols
Sample: Fetch the current user’s friends:
38
39. RESTful and RPC protocols
RESTful and RPC use OAuth for authentication
• OAuth is an open standard.
• Client libraries will help make this process easier for developers.
Sample: use OAuth to get an access token for a user:
39 3
9
43. What’s coming in OpenSocial 0.9
• HTML on your own Server
• OpenSocial Templates
• Other stuff..
• http://wiki.opensocial.org/index.php?title=Spec_Changes
43
44. Dynamic HTML from your own server
Example gadget XML:
<Content href=quot;http://developer.com/canvasquot;>
<os:PeopleRequest userId=quot;@viewerquot; groupId=quot;@friendsquot;
fields=quot;name,birthdayquot; key=quot;ViewerFriendsquot;>
</Content>
Example PHP:
<?php
// Code here will pull POST param into $ViewerFriends
echo quot;<h1>Welcome to the birthday app</h1>quot;;
foreach ($ViewerFriends as $friend) {
if ($friend['birthday']) {
echo quot;<div>quot;.$friend['name'].quot;'s birthday isquot;.
$friend['birthday']quot;</div>quot;;
}
}
?>
44
45. Using OpenSocial Templates
Example gadget XML:
<Content type=quot;htmlquot;>
<h1>Welcome to the birthday app!</h1>
<script type=quot;text/os-templatequot;>
<os:PeopleRequest userId=quot;@viewerquot; groupId=quot;@friendsquot;
fields=quot;name,birthdayquot; key=quot;friendsquot;>
<div repeat=quot;${friends}quot;>
${Name}'s birthday is ${Birthday}
</div>
</script>
</Content>
45
51. Useful Links
New Wiki! (Compliancy, Cross container development …)
• http://wiki.opensocial.org
Homepage & specification:
• http://www.opensocial.org
Get on the forums:
• http://groups.google.com/group/opensocial
Subscribe to the Shindig mailing list:
• shindig-dev-subscribe@incubator.apache.org
Help shape the specification:
• http://groups.google.com/group/opensocial-and-gadgets-spec/
Check out Shindig:
• http://incubator.apache.org/shindig
OS Templates:
• http://groups.google.com/group/opensocial-and-gadgets-spec/web/opensocial-templates
51