Go real time with pubsubhubbub and feeds

5,377 views

Published on

Presented at DrupalCon Copenhagen by Alex Barth.

Published in: Technology
0 Comments
7 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
5,377
On SlideShare
0
From Embeds
0
Number of Embeds
1,106
Actions
Shares
0
Downloads
76
Comments
0
Likes
7
Embeds 0
No embeds

No notes for slide

Go real time with pubsubhubbub and feeds

  1. 1. Realtime with PuSH and Feeds Alex Barth 25. aug 9:00 Acquia Tuesday, August 24, 2010
  2. 2. Development Seed Managing News Tuesday, August 24, 2010
  3. 3. Are we there yet? http://www.flickr.com/photos/geraldbrazell/4562022876/ Tuesday, August 24, 2010
  4. 4. Are we there yet? Are we there yet? Are we there yet? Are we there yet? Are we there yet? rss.xml Publisher Subscriber Yes. Here you are. Are we there yet? Tuesday, August 24, 2010
  5. 5. Ask developmentseed.org every 30 minutes for a new blog post, you’ll download 11 MB for about 9K blog posts a week. Tuesday, August 24, 2010
  6. 6. Do that for 100 similar blogs and you’ll download 1G of data a week just for polling. Tuesday, August 24, 2010
  7. 7. What’s worse: Polling many feeds will back up. http://www.flickr.com/photos/geraldbrazell/4562022876/ Tuesday, August 24, 2010
  8. 8. Publish and Subscribe http://www.flickr.com/photos/geraldbrazell/4562022876/ Tuesday, August 24, 2010
  9. 9. Notification Publisher Subscriber Tuesday, August 24, 2010
  10. 10. PubSubHubbub is a Publish and Subscribe standard Tuesday, August 24, 2010
  11. 11. It solves two problems Tuesday, August 24, 2010
  12. 12. Problem 1: Tons of notifications Subscriber Subscriber Subscriber Subscriber Subscriber Publisher Subscriber Subscriber Subscriber Subscriber Tuesday, August 24, 2010 Subscriber
  13. 13. Problem 1: Tons of notifications Subscriber Solution: Use a Hub Subscriber Subscriber Subscriber Subscriber Publisher Hub Subscriber Subscriber Subscriber Subscriber Tuesday, August 24, 2010 Subscriber
  14. 14. Problem 2: The thundering herd Subscriber Subscriber Subscriber Subscriber Subscriber Publisher Subscriber Subscriber Subscriber Subscriber Tuesday, August 24, 2010 Subscriber
  15. 15. Problem 2: The thundering herd Solution: Send what’s changed (fat ping). Hub Subscriber nges Cha Tuesday, August 24, 2010
  16. 16. And what about RSS Cloud? Tuesday, August 24, 2010
  17. 17. PubSubHubbub is a specification Tuesday, August 24, 2010
  18. 18. It’s all HTTP and XML. Tuesday, August 24, 2010
  19. 19. Tuesday, August 24, 2010
  20. 20. 1. Subscriber POSTs subscription request to the Hub. The request contains the endpoint URL where the Hub should POST new updates. I want to subscribe to feed X, send updates to this URL: Publisher Hub Subscriber From http://code.google.com/p/pubsubhubbub/ Tuesday, August 24, 2010
  21. 21. 2. Hub POSTs to the endpoint URL to verify the request was authentic; Subscriber responds with confirmation to the Hub. Hey there! Did you really send this request? Publisher Hub Subscriber Yup, that was really me, not a DoS attacker. From http://code.google.com/p/pubsubhubbub/ Tuesday, August 24, 2010
  22. 22. 3. Publisher notifies Hub about updates by POSTing feed URLs to the Hub; Hub pulls the feed again to find new entries. I have new content for feed X for you! Publisher Hub Subscriber Give me your latest Here you go. content for feed X, please. From http://code.google.com/p/pubsubhubbub/ Tuesday, August 24, 2010
  23. 23. 4. When Hub receives new update to feed X, it POSTs the update to the Subscriber’s endpoint URL. New update to feed X - here you go: Publisher Hub Subscriber From http://code.google.com/p/pubsubhubbub/ Tuesday, August 24, 2010
  24. 24. 5. If feed X has multiple subscribers, the Hub sends updates to all of them. This reduces load on the Publisher. New update to feed X - here you go: Subscriber Publisher Hub Subscriber Subscriber Subscriber Subscriber Tuesday, August 24, 2010 Subscriber From http://code.google.com/p/pubsubhubbub/
  25. 25. Questions? Tuesday, August 24, 2010
  26. 26. Who supports it? Tuesday, August 24, 2010
  27. 27. Wordpress Tuesday, August 24, 2010
  28. 28. Feedburner Tuesday, August 24, 2010
  29. 29. Blogger (Google, right?) Tuesday, August 24, 2010
  30. 30. Reference Hub Tuesday, August 24, 2010
  31. 31. Hub: Superfeedr Tuesday, August 24, 2010
  32. 32. Drupal as subscriber: Feeds Tuesday, August 24, 2010
  33. 33. Drupal as publisher: 404 Tuesday, August 24, 2010
  34. 34. Check out Views content cache Tuesday, August 24, 2010
  35. 35. Drupal as hub: PuSH Hub (onboard hub) Tuesday, August 24, 2010
  36. 36. Demo time Tuesday, August 24, 2010
  37. 37. function pusher_menu() { $items = array(); $items['realtime.xml'] = array( 'title' => 'Realtime RSS feed', 'page callback' => 'pusher_feed_page', 'access arguments' => array('access content'), 'type' => MENU_CALLBACK, ); return $items; } function pusher_feed_page() { drupal_set_header( 'Content-Type: application/rss+xml; charset=utf-8'); print pusher_feed(); } Tuesday, August 24, 2010
  38. 38. function pusher_nodeapi($node, $op) { if ($op == 'insert' || $op == 'update') { if ($node->status && $node->promote) { pusher_notify($node->nid); } } } function pusher_notify($nid) { node_load(NULL, NULL, TRUE); $changed = pusher_feed(array($nid)); push_hub_notify(url('realtime.xml', array('absolute' => TRUE)), $changed, TRUE); } Tuesday, August 24, 2010
  39. 39. David Weinberger: “Small pieces loosely joined” Tuesday, August 24, 2010
  40. 40. PuSHing users Tuesday, August 24, 2010
  41. 41. Mapping content between sites Tuesday, August 24, 2010
  42. 42. Check out • PubSubHubbub spec • Feeds module (PuSHSubscriber.inc) • PuSH Hub module (PuSHHub.inc) Tuesday, August 24, 2010
  43. 43. What’s next? • Solidify Subscriber support • Implement Publisher support • Solidify content mapping standards • Security: PuSH + OAuth • Content type independence Tuesday, August 24, 2010
  44. 44. Thank you. Questions? Tuesday, August 24, 2010
  45. 45. http://cph2010.drupal.org/node/15363 Tuesday, August 24, 2010

×