What is WebSub? Subscribe to web content updates through a hub
WebSub is an HTTP-based protocol in which a publisher tells a hub that content changed and subscribers receive updates through that hub. A subscriber discovers a topic URL and hub URL from a resource, subscribes, and receives updates at a callback URL. The publisher therefore does not need to maintain its own subscriber list. WebSub does not guarantee permanent event storage or successful delivery of every update, so important workflows need application-level recovery such as retries, deduplication, and periodic reconciliation.
WebSub is an HTTP-based protocol in which a publisher tells a hub that content changed and subscribers receive updates through that hub. A subscriber discovers a topic URL and hub URL from a resource, subscribes, and receives updates at a callback URL. The publisher therefore does not need to maintain its own subscriber list. WebSub does not guarantee permanent event storage or successful delivery of every update, so important workflows need application-level recovery such as retries, deduplication, and periodic reconciliation.
The publisher, hub, and subscriber
A WebSub topic is an HTTP resource URL whose changes can be followed. The publisher owns the content and informs the hub of updates. A subscriber is a person or program interested in changes. The hub validates subscriptions and distributes updated content. WebSub was formerly known as PubSubHubbub.
Discover topic + hub from a resource URL
Subscriber ── subscription request ──▶ Hub
Subscriber ◀── intent verification ─── Hub
Publisher ── update notice ──▶ Hub ── content POST ──▶ Subscriber callbackThe subscriber first discovers the topic URL and hub URL. The standard defines discovery mechanisms including HTTP Link headers; the resource URL can differ from the canonical topic URL. A publisher advertises a hub link and a rel=self topic link. WebSub leaves the specific publisher-to-hub update mechanism to agreement between the publisher and hub. Do not assume an arbitrary hub URL or a generic hub.mode=publish example works with every hub.
Request a subscription and verify intent
The subscriber sends a form-urlencoded POST to a discovered hub, usually with:
`hub.mode=subscribe`
`hub.topic`: the discovered canonical topic URL
`hub.callback`: the subscriber's callback URL for deliveries
Optional `hub.lease_seconds` and `hub.secret`
The hub may return 202 Accepted when it receives the request. That means it accepted the request for processing; it does not mean the subscription has been validated and confirmed. The hub sends a GET verification request to the callback with hub.mode, hub.topic, a random hub.challenge, and, for a subscription, hub.lease_seconds. The subscriber must check that the topic and mode match an intent it is awaiting. If they do, it returns 2xx with the challenge exactly in the response body; otherwise it rejects with 404. A non-2xx response or mismatched body means verification failed.
The verification callback is a security boundary, not a public endpoint that blindly echoes query strings. Check the requested topic and action against a pending subscription intent to prevent third parties from creating or removing subscriptions. The current W3C Recommendation requires a safe media type such as application/octet-stream and X-Content-Type-Options: nosniff on the verification response to mitigate reflected XSS and content-type confusion. Also limit challenge length and reject binary or malformed input.
The hub-determined hub.lease_seconds is the subscription's remaining lifetime. A subscriber may request a duration, but the hub can choose another. Do not assume subscriptions last forever: schedule renewal before the granted lease expires. Unsubscription (hub.mode=unsubscribe) uses the same intent-verification flow; the subscriber ignores any lease value on that confirmation.
Delivery, acknowledgement, and signatures
When the publisher notifies the hub of a topic update, the hub sends a content distribution request to callbacks subscribed to that topic. It can send the full content or a supported delta. The subscriber acknowledges a delivery with HTTP 2xx. This is a protocol-level receipt acknowledgement, not proof that the subscriber's business database finished processing the update. For slow work, safely enqueue the request durably before returning 2xx, then recover queue-processing failures separately.
If the subscription includes hub.secret, the hub must include an HMAC of the request body in the X-Hub-Signature header. Verify it against the original request-body bytes using the named algorithm, and do not process invalid deliveries. The standard recognizes several HMAC algorithm names; its current security section recommends at least SHA-256 in light of SHA-1's weakness. Hub support can vary, so verify the actual hub contract. The signature protects the payload against forgery; it does not make otherwise unprotected request headers trustworthy. Prefer HTTPS for all requests and generate, protect, and rotate secrets per subscription.
If delivery fails, a hub may retry according to its own policy, but WebSub does not guarantee eventual success within a fixed number of attempts or durable replay of all deliveries. Check the hub's retry limits and response timeout. On the subscriber side, make duplicate processing safe using event or content identifiers, renew subscriptions, monitor for missing updates, and periodically compare with the source to detect gaps.
Operational checklist
| Area | Implementation check |
|---|---|
| Discovery | Use the advertised canonical topic and hub; explicitly handle redirects and multiple-hub policy |
| Callback reachability | Use an HTTPS callback directly reachable by the hub and a unique, hard-to-guess URL |
| Verification | Match topic and mode against pending state; echo only the exact challenge; set a safe media type and nosniff |
| Renewal and removal | Resubscribe before the granted lease expires; record expiry, unsubscribe, and retry states |
| Delivery | Verify signatures using the raw body and make duplicates safe; separate processing from the time of 2xx acknowledgement |
| Recovery | Check hub-specific retry limits and source-query options; schedule periodic reconciliation |
WebSub replaces direct polling between publishers and subscribers with a standardized hub-mediated HTTP notification contract. Subscription verification, leases, callback security, and delivery authentication are part of the standard flow, while publisher-to-hub notification and a production hub's delivery guarantees remain separate contracts. For important events, keep a recovery path that can recheck the source instead of relying on notifications alone.
Sources
[W3C Recommendation: WebSub (2026-06-02)](https://www.w3.org/TR/websub/)
[W3C WebSub test suite](https://websub.rocks/)
[WebSub implementation reports](https://websub.net/implementation-reports)