Crossing the Boundaries of Web Applications with OpenSocial

59
Crossing the boundaries of web applications with OpenSocial Bastian Hofmann VZnet Netzwerke Ltd.

description

This are the slides for my Devlink OpenSocial talk. Code of the demo is available at https://github.com/bashofmann/statusnet_gadget

Transcript of Crossing the Boundaries of Web Applications with OpenSocial

Page 1: Crossing the Boundaries of Web Applications with OpenSocial

Crossing the boundaries of web applications with OpenSocialBastian HofmannVZnet Netzwerke Ltd.

Page 2: Crossing the Boundaries of Web Applications with OpenSocial
Page 3: Crossing the Boundaries of Web Applications with OpenSocial
Page 4: Crossing the Boundaries of Web Applications with OpenSocial
Page 5: Crossing the Boundaries of Web Applications with OpenSocial
Page 6: Crossing the Boundaries of Web Applications with OpenSocial

Questions? Ask!

Page 8: Crossing the Boundaries of Web Applications with OpenSocial

http://www.opensocial.org/

Page 9: Crossing the Boundaries of Web Applications with OpenSocial

A set of APIs to access the social graph of users

Page 10: Crossing the Boundaries of Web Applications with OpenSocial

A specification for including 3rd party

applications (gadgets) into social services

Page 11: Crossing the Boundaries of Web Applications with OpenSocial
Page 12: Crossing the Boundaries of Web Applications with OpenSocial
Page 13: Crossing the Boundaries of Web Applications with OpenSocial
Page 14: Crossing the Boundaries of Web Applications with OpenSocial
Page 15: Crossing the Boundaries of Web Applications with OpenSocial
Page 16: Crossing the Boundaries of Web Applications with OpenSocial
Page 17: Crossing the Boundaries of Web Applications with OpenSocial
Page 18: Crossing the Boundaries of Web Applications with OpenSocial
Page 19: Crossing the Boundaries of Web Applications with OpenSocial

• XML file with HTML and JavaScript (and CSS, Images, Flash, ...)

• Application based on the Google Gadgets specification

• Can be included on various platforms

What is a Gadget?

Page 20: Crossing the Boundaries of Web Applications with OpenSocial
Page 21: Crossing the Boundaries of Web Applications with OpenSocial

Rendering

Page 22: Crossing the Boundaries of Web Applications with OpenSocial

Social APIs

Page 23: Crossing the Boundaries of Web Applications with OpenSocial

Views

Page 24: Crossing the Boundaries of Web Applications with OpenSocial

CANVAS

Page 25: Crossing the Boundaries of Web Applications with OpenSocial

PROFILE

Page 26: Crossing the Boundaries of Web Applications with OpenSocial

POPUP

Page 27: Crossing the Boundaries of Web Applications with OpenSocial

GROUP

Page 28: Crossing the Boundaries of Web Applications with OpenSocial

EMBED

Page 29: Crossing the Boundaries of Web Applications with OpenSocial

PREVIEW

Page 30: Crossing the Boundaries of Web Applications with OpenSocial

Features

Page 31: Crossing the Boundaries of Web Applications with OpenSocial
Page 32: Crossing the Boundaries of Web Applications with OpenSocial

Application models

Page 33: Crossing the Boundaries of Web Applications with OpenSocial

JavaScript basedContainervz.net

Gadget apivz.net

Gadget Backendapi.twitter.com

Ajax

HTTP

Shindigapivz.net

HTTP

Page 34: Crossing the Boundaries of Web Applications with OpenSocial

Containervz.net

Gadget apivz.net

Gadget Backendapi.twitter.com

Shindigapivz.net

Ajax

Ajax

HTTP

Proxy

Page 35: Crossing the Boundaries of Web Applications with OpenSocial

Containervz.net

Gadget apivz.net

Method Call

- window.postMessage

- Iframes with relay files

- Flash

JavaScript RPC

Page 36: Crossing the Boundaries of Web Applications with OpenSocial

FlashContainervz.net

Gadget apivz.net Gadget Backend

api.twitter.comHTTP

Shindigapivz.net

Flash

Ajax

HTTP

HTTP

Page 37: Crossing the Boundaries of Web Applications with OpenSocial

RedirectingContainervz.net

Gadget Backendapi.twitter.com

Shindigapivz.net

iframeapi.twitter.com

HTTP

Ajax

Page 38: Crossing the Boundaries of Web Applications with OpenSocial

Additional IframeContainervz.net

Gadget apivz.net Gadget Backend

api.twitter.com

Shindigapivz.net

iframe

Ajax

Ajax

HTTP

Page 39: Crossing the Boundaries of Web Applications with OpenSocial

Let‘s start programming

OpenSocial Templates

OEmbed

OAuth Proxy Requests

DataPipelining

OSAPI

AppData

Proxied Content

Page 41: Crossing the Boundaries of Web Applications with OpenSocial

DEMO

Page 42: Crossing the Boundaries of Web Applications with OpenSocial

OAuth 1.0a Flow +----------+ +---------------+ | -+----(B)-- Request Token -------->| | | End-user | | Authorization | | at |<---(C)-- User authenticates --->| Server | | Browser | | | | -+----(D)-- Verifier -------------<| | +-|----|---+ +---------------+ | | ^ v (B) (D) | | | | | | ^ v | | +---------+ | | | |>---(A)-- Redirect URL ---------------| | | Web |<---(A)-- Request Token + Secret -----| | | Client |>---(E)-- Request Token, Verifier ----' | | |<---(E)-- Access Token + Secret -------------' +---------+

Every Request: Client Credentials, Nonce, Timestamp, Signaturehttp://oauth.net/

Page 43: Crossing the Boundaries of Web Applications with OpenSocial

DEMO

Page 44: Crossing the Boundaries of Web Applications with OpenSocial

<script type="text/javascript">var viewers= opensocial.data.DataContext.getDataSet("ViewerFriends");var html="<ul>";for (var i=0; i < viewers.length; i++) { html += "<li>" + viewers[i].displayName + "</li>";}document.getElementById("div").innerHTML = html;</script>

BAD

Displaying data

Page 45: Crossing the Boundaries of Web Applications with OpenSocial

DEMO

Page 46: Crossing the Boundaries of Web Applications with OpenSocial
Page 47: Crossing the Boundaries of Web Applications with OpenSocial

Embedded Experience

Page 48: Crossing the Boundaries of Web Applications with OpenSocial

From: [email protected]: [email protected]: Social Network: Mary Has Commented On Your StatusMIME-Version: 1.0Content-Type: multipart/alternative; boundary="XXXXboundary text"

--XXXXboundary textContent-Type: text/html

<html><!-- HTML representation here --></html>

--XXXXboundary textContent-Type: application/embed+json{ "gadget" : "http://www.socialnetwork.com/embedded/commentgadget.xml", "context" : 123}

Page 49: Crossing the Boundaries of Web Applications with OpenSocial

OpenSearch

Page 50: Crossing the Boundaries of Web Applications with OpenSocial

<Optional feature="opensearch">  <Param name="description">  <![CDATA[    <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">      <ShortName>Example Search</ShortName>      <Description>Realtime Example Search</Description>      <Url type="application/atom+xml" method="get" template="http://search.example.com/search.atom?q={searchTerms}"/>      <Image width="16" height="16">http://search.example.com/favicon.png</Image>      <InputEncoding>UTF-8</InputEncoding>       <SearchForm>http://search.example.com/</SearchForm>    </OpenSearchDescription>  ]]>  </Param></Optional>

Page 51: Crossing the Boundaries of Web Applications with OpenSocial

Common Container

Page 52: Crossing the Boundaries of Web Applications with OpenSocial

http://activitystrea.ms/

Page 53: Crossing the Boundaries of Web Applications with OpenSocial

View Level Features

Page 54: Crossing the Boundaries of Web Applications with OpenSocial

<Module> <ModulePrefs title="View Level Features Sampe">  <Require feature="opensocial" views="canvas,profile" /> </ModulePrefs>

Page 55: Crossing the Boundaries of Web Applications with OpenSocial

Declarative actions

Page 56: Crossing the Boundaries of Web Applications with OpenSocial

<Module> <ModulePrefs title="Sample VOIP">  <Optional feature="actions">   <Param name="action-contributions">    <![CDATA[   <action id="org.samplevoip.callbyperson" dataObject="opensocial.Person" label="Call using VOIP Phone"     view="DialByPerson" icon="http://ww.samplervoip.org/phone.gif" />   <action id="org.samplervoip.navLink" path="container/navigationLinks" label="Phone" />   ]]>   </Param>  </Optional> </ModulePrefs> 

Page 57: Crossing the Boundaries of Web Applications with OpenSocial

<Content type="html">  <![CDATA[  <script>

        // Bind javascript function to action ID        function mycallback{                ...        }        var myaction = {                id: "org.samplevoip.callbyperson",                callback: mycallback        }        container.actions.updateAction(myaction);

  </script> ]]> </Content></Module>