Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Decentralization & real-time with PubSubHubbub

Bruno Renié
October 25, 2013
140

Decentralization & real-time with PubSubHubbub

Bruno Renié

October 25, 2013
Tweet

Transcript

  1. Decentralization &
    real-time with
    PubSubHubbub
    Bruno Renié soft-shake 2013

    View Slide

  2. exoscale

    View Slide

  3. FeedHQ.org
    github.com/feedhq

    View Slide

  4. 2009
    RSS Readers

    View Slide

  5. Any update?
    Any update?
    Any update?
    Nope.
    Nope.
    Yup.
    Blog
    RSS Reader

    View Slide

  6. Polling sucks
    — everyone

    View Slide

  7. Publisher
    Hub
    Subscriber

    View Slide

  8. De�nitions
    Topic The unit to which one can subscribe to changes
    Hub Intermediary
    Subscriber Entity willing to be noti�ed of changes on a topic
    Subscription Subscriber - Topic relation
    Callback URL URL at which a subscriber wishes to
    receive noti�cations.
    Noti�cation Payload describing how a topic's contents
    have changed

    View Slide

  9. Publisher
    Declares his hub
    Pings the hub about new content

    POST http://example/hub
    hub.url=
    hub.mode=publish

    View Slide

  10. Subscriber
    Notices the publisher has a hub
    Subscribes to the hub
    POST http://example/hub
    hub.topic=
    hub.mode=subscribe
    hub.callback=

    View Slide

  11. Hub
    Receives pings
    Fetches publisher feeds
    Receives subscriptions
    Noti�es all subscribers

    View Slide

  12. Subscription
    Subscriber sees link with rel="hub"

    Subscriber makes POST request to hub
    POST http://example/hub
    hub.topic=
    hub.mode=subscribe
    hub.callback=http://subscriber/callback

    View Slide

  13. Subscription
    Hub makes GET request to subscriber callback
    GET http://subscriber/callback
    hub.topic=
    hub.mode=subscribe
    hub.challenge=hello
    hub.lease_seconds=86400

    View Slide

  14. Publication
    Publisher pings the hub
    POST http://example/hub
    hub.url=
    hub.mode=publish

    View Slide

  15. Publication
    Hub fetches the topic & posts the content to callback
    POST http://subscriber/callback
    Link: ; rel="hub",
    ; rel="self"
    Content-Type: application/xml

    View Slide

  16. Demo
    http://www.flickr.com/photos/usnavy/6628020661/

    View Slide

  17. PubSubHubbub
    HTTP-based pub/sub protocol
    Open-Source GAE implementation
    Decentralized

    View Slide

  18. Decentralized?
    Anyone can host a hub
    In practice: Google hub & superfeedr
    http://pubsubhubbub.appspot.com/
    http://superfeedr.com/

    View Slide

  19. Security
    Making sure noti�cations come
    from the real hub
    Hub/Subscriber shared secret
    Hub signs its requests with
    HMAC SHA1 digest
    X-Hub-Signature: sha1=d07d89c67…

    View Slide

  20. Real-life publishers
    wordpress / wordpress.com
    tumblr
    �attr
    blogger
    youtube
    GitHub

    View Slide

  21. feedhq.org
    ~25% of feeds have a hub

    View Slide

  22. Beyond RSS
    Initial spec (0.3) targeted Atom/RSS
    Current (0.4) allows arbitrary content

    Link: ; rel="hub"

    View Slide

  23. Publisher
    Hub
    Subscriber
    Subscriber
    Subscriber
    Subscriber
    Subscriber
    Subscriber

    View Slide

  24. Hub
    Publisher
    Subscriber
    Publisher
    Subscriber
    Publisher
    Subscriber

    View Slide

  25. View Slide

  26. Thanks !
    @brutasse
    [email protected]

    View Slide