59
Jonathan LeBlanc Principal Software Engineer Yahoo! Developer Network Twitter: @jcleblanc Web: http://www.jcleblanc.com Programming Social Applications

Programming Social Applications

Embed Size (px)

DESCRIPTION

Programming Social Applications talk at ConvergeSE 2011 (Columbia, SC)

Citation preview

Page 1: Programming Social Applications

Jonathan LeBlancPrincipal Software EngineerYahoo! Developer Network

Twitter: @jcleblancWeb: http://www.jcleblanc.com

Programming Social Applications

Page 2: Programming Social Applications

What We’re Going to Cover

• The Social Application: Core Concepts

• Finger to Webfinger: Find User Social Data

• Return of the Semantic Web: The Open Graph Protocol

• Defining User Actions: Activity Streams

• Controlling Content Syndication: PubSubHubbub and Salmon

Page 3: Programming Social Applications

What We’re Going to Cover

• The Social Application: Core Concepts

• Finger to Webfinger: Find User Social Data

• Return of the Semantic Web: The Open Graph Protocol

• Defining User Actions: Activity Streams

• Controlling Content Syndication: PubSubHubbub and Salmon

Page 4: Programming Social Applications

Core Concepts: What is a Social Application?

Page 5: Programming Social Applications

Core Concepts: What Makes up a Social Application?

Sharing Model

The Social Graph

Relationship Model

Page 6: Programming Social Applications

Core Concepts: The Social Graph

Page 7: Programming Social Applications

Core Concepts: Applying the Real Life Social Graph Online

Page 8: Programming Social Applications

Core Concepts: The Different Sharing Models

The Opt-in Model

The Opt-out Model

Page 9: Programming Social Applications

Core Concepts: Relationship Models

Group Model

Connection Model

Follower Model

Page 10: Programming Social Applications

What We’re Going to Cover

• The Social Application: Core Concepts

• Finger to Webfinger: Find User Social Data

• Return of the Semantic Web: The Open Graph Protocol

• Defining User Actions: Activity Streams

• Controlling Content Syndication: PubSubHubbub and Salmon

Page 11: Programming Social Applications

WebFinger

http://code.google.com/p/webfinger/

Page 12: Programming Social Applications

WebFinger: Origin Through the Finger Protocol

Login name: jleblancIn real life: Jonathan LeBlancHome phone: 123-4567Office: Sunnyvale, CALast Login: Tue Jun 21 15:41 on ttys000

[email protected]://www.jcleblanc.com

finger [email protected]

Page 13: Programming Social Applications

WebFinger: How it Works

Page 14: Programming Social Applications

WebFinger: How it Works

Page 15: Programming Social Applications

WebFinger: How it Works

Page 16: Programming Social Applications

WebFinger: Performing WebFinger Discovery

<XRD xmlns='http://docs.oasis-open.org/ns/xri/xrd-1.0' xmlns:hm='http://host-meta.net/xrd/1.0'> <hm:Host xmlns='http://host-meta.net/xrd/1.0'> gmail.com</hm:Host> <Link rel='lrdd' template= 'http://www.google.com/s2/webfinger/?q={uri}'> <Title>Resource Descriptor</Title> </Link></XRD>

curl http://gmail.com/.well-known/host-meta

Page 17: Programming Social Applications

WebFinger: Performing WebFinger Discovery

The User Profile: http://www.google.com/profiles/nakedtechnologist

The portable contacts link: http://www-opensocial.googleusercontent.com/api/people/118167121283215553793/

The public Google Buzz feed: https://www.googleapis.com/buzz/v1/activities/118167121283215553793/@public

curl http://www.google.com/s2/webfinger/[email protected]

Page 18: Programming Social Applications

WebFinger: Homework

Using the well-known host-meta file, attempt to obtain your public profile from www.yahoo.com

Page 19: Programming Social Applications

What We’re Going to Cover

• The Social Application: Core Concepts

• Finger to Webfinger: Find User Social Data

• Return of the Semantic Web: The Open Graph Protocol

• Defining User Actions: Activity Streams

• Controlling Content Syndication: PubSubHubbub and Salmon

Page 20: Programming Social Applications

The Open Graph Protocol

http://ogp.me/

Page 21: Programming Social Applications

Open Graph Protocol: How Web Semantics Work

Page 22: Programming Social Applications

Open Graph Protocol: How Web Semantics Work

Geo<span class="geo"> <span class="latitude">52.48</span>, <span class="longitude">-1.89</span></span>

vCard<div class="vcard"> <div class="fn">Joe Doe</div> <div class="org">The Example Company</div> <div class="tel">604-555-1234</div> <a class="url" href="http://site.com/">http://site.com/</a> </div>

Page 23: Programming Social Applications

Open Graph Protocol: Vision of the Semantic Web

Page 24: Programming Social Applications

Open Graph Protocol: Reality of the Semantic Web

Page 25: Programming Social Applications

Open Graph Protocol: What Changed?

Page 26: Programming Social Applications

Open Graph Protocol: How it Works

Page 27: Programming Social Applications

Open Graph Protocol: How it Works

Page 28: Programming Social Applications

Open Graph Protocol: How it Works

Page 29: Programming Social Applications

Open Graph Protocol: The Meta Data Format

<html xmlns:og="http://ogp.me/ns#"><head><title>Restaurant at Wente Vineyards – Livermore</title><meta property="og:url" content="http://www.yelp.com/biz/gATFcG9HTaXJpg"><meta property="og:type" content="restaurant"> <meta property="og:title" content="The Restaurant at Wente Vineyards"> <meta property="og:image" content="http://media2.px.yelpcdn.com/iVSnIs"> ...</head>...</html>

Page 30: Programming Social Applications

Open Graph Protocol: What is Defined?

• Basic Metadata• Location• Contact Information• Video Data• Audio Data• Objects

• Activities• Businesses• Groups• Organizations

• People• Places• Products and Entertainment• Websites

Page 31: Programming Social Applications

Open Graph Protocol: Drawbacks

How do we differentiating like objects from one another?

How do we define definitions for an entire page versus a single object?

Page 32: Programming Social Applications

Open Graph Protocol: Homework

Construct an Open Graph meta-data parser, then extract Open Graph meta-data from a restaurant page on www.yelp.com

Hint: The www.ogp.me page has parser helpers.

Page 33: Programming Social Applications

What We’re Going to Cover

• The Social Application: Core Concepts

• Finger to Webfinger: Find User Social Data

• Return of the Semantic Web: The Open Graph Protocol

• Defining User Actions: Activity Streams

• Controlling Content Syndication: PubSubHubbub and Salmon

Page 34: Programming Social Applications

Activity Streams

http://activitystrea.ms/

Page 35: Programming Social Applications

Activity Streams: What is an Activity?

Page 36: Programming Social Applications

Activity Streams: What is an Activity?

• Photo: The Object

Mary added to a new photo into her collection.

• Mary: The Actor

• Collection: The Target

Page 37: Programming Social Applications

Activity Streams: The Standard JSON Object

{ "items" : [{ "verb": "post", "published": "2011-02-18T16:26:43Z", "provider": { "url": "http://providersite.com/activity-stream" }, "title": "Mary added a photo to her album.", "actor": { ... }, "object" : { ... }, "target": { ... } }]}

Page 38: Programming Social Applications

Activity Streams: The Actor

"actor": { "url": "http://providersite.com/mary", "objectType": "person", "id": "tag:provider.com,20110218,162643:mary", "image": { "url": "http://providersite.com/mary/image", "width": 125, "height": 125 }, "displayName": "Mary Smith"},

Mary added to a new photo into her collection.

Page 39: Programming Social Applications

Activity Streams: The Object

"object" : { "url": "http://site.com/mary/album/place.jpg", "objectType": "http://activitystrea.ms/schema/1.0/photo", "id": "tag:provider.com,20110218,162643:place", "image": { "url": "http://site.com/mary/album/thumb.jpg", "width": 100, "height": 100 }},

Mary added to a new photo into her collection.

Page 40: Programming Social Applications

Activity Streams: The Target

"target": { "url": "http://targetsite.com/mary/album/", "objectType": "http://activitystrea.ms/schema/1.0/ photo-album", "id": "tag:example.org,20110218,162643:album4323", "displayName": "Mary's Photo Album", "image": { "url": "http://site.com/mary/album/thumbnail.jpg", "width": 100, "height": 100 }}

Mary added to a new photo into her collection.

Page 41: Programming Social Applications

Activity Streams: Object Properties

Object PropertiesattachmentsauthorcontentdisplaynamedownstreamDuplicatesidimage

objecttypepublishedsummaryupdatedupstreamDuplicatesurl

Media Object Propertiesdurationheight

url width

Page 42: Programming Social Applications

Activity Streams: Homework

Take one of your activities (with a photo) from Facebook and convert it to an activity stream object.

Page 43: Programming Social Applications

What We’re Going to Cover

• The Social Application: Core Concepts

• Finger to Webfinger: Find User Social Data

• Return of the Semantic Web: The Open Graph Protocol

• Defining User Actions: Activity Streams

• Controlling Content Syndication: PubSubHubbub and Salmon

Page 44: Programming Social Applications

PubSubHubbub

http://code.google.com/p/pubsubhubbub/

Page 45: Programming Social Applications

PubSubHubbub: How it Works

Page 46: Programming Social Applications

PubSubHubbub: How it Works

Page 47: Programming Social Applications

PubSubHubbub: How it Works

Page 48: Programming Social Applications

PubSubHubbub: How it Works

Page 49: Programming Social Applications

PubSubHubbub: How it Works

Page 50: Programming Social Applications

The Salmon Protocol

www.salmon-protocol.org

Page 51: Programming Social Applications

The Salmon Protocol: How it Works

Page 52: Programming Social Applications

The Salmon Protocol: How it Works

Page 53: Programming Social Applications

The Salmon Protocol: How it Works

Page 54: Programming Social Applications

The Salmon Protocol: Things to Consider

• How does the publisher prevent spam or abuse?

• Is the content coming from a trusted source?

• How does the publisher ensure the quality of the updates?

Page 55: Programming Social Applications

The Salmon Protocol: Determining Source

1. Subscriber sends signed request to publisher (e.g. using acct:[email protected]).

2. Publisher performs discovery on endpoint to verify identity provider.

• Webfinger• LRDD (Link-based Resource Descriptor)

3. Provider verifies signature via public keys obtained during discovery.

Page 56: Programming Social Applications

Pubsubhubbub and Salmon: Homework

Construct a subscriber to subscribe to a hub, then create a publisher to push a feed to a hub.

Hint: www.superfeedr.com has a hosted hub solution at http://superfeedr.com/hubbub

Page 57: Programming Social Applications

What We’re Going to Cover

• The Social Application: Core Concepts

• Finger to Webfinger: Find User Social Data

• Return of the Semantic Web: The Open Graph Protocol

• Defining User Actions: Activity Streams

• Controlling Content Syndication: PubSubHubbub and Salmon

Page 58: Programming Social Applications

Resources

This Presentation:http://www.slideshare.net/jcleblanc/programming-social

Code Sources:https://github.com/jcleblanc/programming-social-applications

Purchase the Book:Amazon: http://amzn.to/mQrUkE O’Reilly: http://oreil.ly/gzEKiM O’Reilly ebook code (50% off): DDM97

Follow Updates:Facebook: www.facebook.com/programmingsocialappsTwitter: @socialappsbook

Page 59: Programming Social Applications

Questions?

http://www.slideshare.net/jcleblanc/slideshare.net/jcleblanc/programming-social

Jonathan LeBlanc

Twitter: @jcleblanc

E-Mail: [email protected]