WebSub (formerly PubSub)

repository·master·Indexed 43 days ago

https://github.com/w3c/websub

A W3C specification providing a mechanism for notifying subscribers of new content updates via a pub/sub model. This documentation includes the official W3C Recommendation, Editor's Draft, and implementation reports for various hubs including Ballerina, Dobrado, Flask-WebSub, Mastodon, Promulgate, Google WebSub Hub, and Switchboard.

Tokens
9.9K
Snippets
5
Records
76
Agent score
46%

What's inside WebSub

  1. Twitch WebSub Implementation Details

    master

    Twitch provides a WebSub implementation for handling webhooks. This implementation is written in Go and is used to notify subscribers of changes to specific topics.

    Key characteristics:

    • Subscription Support: Supports standard WebSub parameters including hub.mode, hub.topic, hub.callback, and hub.secret.
    • Security: Uses sha256 for signing notifications.
    • Content-Type: Notifications are sent with a Content-Type that matches the topic URL.
    • Lease Management: Allows subscribers to request specific lease durations and re-request active subscriptions before they expire.
    • Unsubscription: Supports standard unsubscription requests.
  2. WebSub implementation in WSO2 API Manager (4.1.0+)

    master

    WSO2 API Manager (version 4.1.0 and onwards) provides a WebSub implementation using Java and WSO2 Synapse. It supports both the Subscription and Distribution aspects of the WebSub protocol.

    Subscription Capabilities:

    • Supports hub.mode, hub.topic, and hub.callback parameters.
    • Supports hub.secret for secure subscriptions.
    • Allows subscribers to re-request active subscriptions before expiration.
    • Supports unsubscription requests.
    • Allows subscribers to request a specific lease duration.
    • Sends properly formatted verification requests for both subscribing and unsubscribing.
    • Ignores unrecognized parameters in subscription requests.

    Distribution Capabilities:

    • Sends notifications with a content-type matching the topic URL.
    • Sends notifications containing the full contents of the topic.
    • Signs requests using the sha1 signature method.
  3. Mastodon WebSub Implementation Details

    master
    Mastodon provides a WebSub implementation written in Ruby. It supports advanced subscription features including hub.secret for authentication and allows subscribers to request specific lease durations (subject to enforced min/max ranges). It also supports re-requesting active subscriptions before expiration and handles unsubscription requests.
  4. Use the Google WebSub Hub (pubsubhubbub.appspot.com)

    master

    The Google WebSub Hub (hosted at http://pubsubhubbub.appspot.com/) is a production implementation of the WebSub protocol. It allows publishers to broadcast updates to subscribers via a centralized hub.

    Subscription Capabilities

    When subscribing to a topic via this hub, you can use the following parameters and features:

    • Core Parameters: Supports hub.mode, hub.topic, and hub.callback.
    • Security: Supports hub.secret for signed requests.
    • Lease Management: Allows subscribers to request a specific lease duration and re-request active subscriptions before they expire.
    • Unsubscription: Supports standard unsubscription requests.
    • Verification: Sends properly formatted verification requests for both subscribing and unsubscribing.

    Distribution Capabilities

    When the hub notifies a subscriber of a change, it provides:

    • Content Matching: Notifications include a content-type matching the topic URL.
    • Full Content: Sends the full contents of the topic.
    • Signatures: Notifications are signed using the sha1 method.
    • Feed Optimization: For Atom or RSS feeds, the hub sends only a diff of the topic URL.
  5. FeedMail WebSub Implementation Capabilities

    master

    FeedMail is a Rust-based WebSub implementation. It supports various discovery methods, subscription workflows (including handling redirects), and distribution notifications.

    Discovery Support:

    • HTTP header discovery: Discovers hub and self URLs from HTTP headers.
    • Atom feed discovery: Discovers hub and self URLs from XML <link> tags.
    • RSS feed discovery: Discovers hub and self URLs from XML <atom:link> tags.
    • Discovery priority: Prioritizes HTTP headers over links found in the body.

    Subscription Support:

    • Successfully creates subscriptions.
    • Handles topic URLs and hubs that send HTTP 301 (permanent) or 302 (temporary) redirects.
    • Rejects verification requests with invalid topic URLs.
    • Supports requesting subscriptions with a specific lease_seconds (though the hub may ignore this).
    • Uses unique and unguessable callback URLs per subscription.

    Distribution Support:

    • Returns HTTP 2xx when notification payloads are successfully delivered.
    • Rejects distribution requests with invalid signatures.