{"result":{"depiction_url":null,"edges":{"observes":{"objects":[{"created":"2026-09-29T13:07:37Z","object_id":{"id":1466,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_admin_menu","title":"observe_admin_menu\/3","uri":"https:\/\/zotonic.com\/id\/1466"},"seq":1},{"created":"2026-09-29T13:07:37Z","object_id":{"id":1468,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_acl_is_allowed","title":"observe_acl_is_allowed\/2","uri":"https:\/\/zotonic.com\/id\/1468"},"seq":2},{"created":"2026-09-29T13:07:37Z","object_id":{"id":1981,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_rsc_update_done","title":"observe_rsc_update_done\/2","uri":"https:\/\/zotonic.com\/id\/1981"},"seq":3},{"created":"2026-09-29T13:07:37Z","object_id":{"id":2126,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_edge_delete","title":"observe_edge_delete\/2","uri":"https:\/\/zotonic.com\/id\/2126"},"seq":4},{"created":"2026-09-29T13:07:37Z","object_id":{"id":2137,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_edge_update","title":"observe_edge_update\/2","uri":"https:\/\/zotonic.com\/id\/2137"},"seq":5},{"created":"2026-09-29T13:07:37Z","object_id":{"id":2168,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_edge_insert","title":"observe_edge_insert\/2","uri":"https:\/\/zotonic.com\/id\/2168"},"seq":6},{"created":"2026-09-29T13:07:37Z","object_id":{"id":2286,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_resource_headers","title":"observe_resource_headers\/3","uri":"https:\/\/zotonic.com\/id\/2286"},"seq":7},{"created":"2026-09-29T13:07:37Z","object_id":{"id":2293,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_rsc_import_fetch","title":"observe_rsc_import_fetch\/2","uri":"https:\/\/zotonic.com\/id\/2293"},"seq":8},{"created":"2026-09-29T13:07:37Z","object_id":{"id":2699,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_rsc_import_fetch_result","title":"observe_rsc_import_fetch_result\/3","uri":"https:\/\/zotonic.com\/id\/2699"},"seq":9},{"created":"2026-09-29T13:07:37Z","object_id":{"id":2700,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_rsc_import_done","title":"observe_rsc_import_done\/2","uri":"https:\/\/zotonic.com\/id\/2700"},"seq":10},{"created":"2026-09-29T13:07:37Z","object_id":{"id":2701,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_rsc_export_done","title":"observe_rsc_export_done\/3","uri":"https:\/\/zotonic.com\/id\/2701"},"seq":11}],"predicate":{"id":2550,"is_a":["meta","predicate"],"name":"observes","title":{"_type":"trans","tr":{"en":"Observes"}},"uri":"https:\/\/zotonic.com\/id\/observes"}},"subject":{"objects":[{"created":"2026-09-29T13:07:37Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-09-29T13:07:37Z","object_id":{"id":2565,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_integrator","title":"Integrator","uri":"https:\/\/zotonic.com\/id\/2565"},"seq":2},{"created":"2026-09-29T13:07:37Z","object_id":{"id":2599,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_api_and_integration","title":"API and integration","uri":"https:\/\/zotonic.com\/id\/2599"},"seq":3},{"created":"2026-09-29T13:07:37Z","object_id":{"id":2601,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_export_and_syndication","title":"Export and syndication","uri":"https:\/\/zotonic.com\/id\/2601"},"seq":4},{"created":"2026-09-29T13:07:37Z","object_id":{"id":2635,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_module","title":"Module","uri":"https:\/\/zotonic.com\/id\/2635"},"seq":5},{"created":"2026-09-29T13:07:37Z","object_id":{"id":2665,"is_a":["categorization","keyword","keyword_data_type"],"name":"zotonic_topic_structured_data","title":"Structured data","uri":"https:\/\/zotonic.com\/id\/2665"},"seq":6},{"created":"2026-09-29T13:07:37Z","object_id":{"id":2676,"is_a":["categorization","keyword","keyword_technology"],"name":"zotonic_topic_http","title":"HTTP","uri":"https:\/\/zotonic.com\/id\/2676"},"seq":7}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"export_revision":274,"id":2703,"is_a":["text","documentation","reference","module"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2703"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_module_mod_websub","page_url":{"en":"https:\/\/zotonic.com\/docs\/2703\/mod_websub","x-default":"https:\/\/zotonic.com\/docs\/2703\/mod_websub"},"preview_url":null,"resource":{"version":274,"pivot_location_lat":null,"title":"mod_websub","is_authoritative":true,"body":"<p>WebSub keeps imported resources up to date when their source changes. A publishing\nsite notifies subscribers instead of requiring them to poll for every update.\n<code>mod_websub<\/code> provides both publication and subscription for Zotonic resources,\nusing the WebSub protocol.<\/p>\n<h2>When to use it<\/h2>\n<p>Use this module to synchronize resources between sites while preserving their\noriginal identity and applying the importing editor&#39;s permissions and options.\nChanges to collections can also update membership and order. Subscribing to a\ncollection does not, by itself, keep every member&#39;s content up to date.<\/p>\n<p>Both sites need reachable URLs for subscription verification and delivery; use\nHTTPS for deployment. Enable <code>mod_websub<\/code> on both sites when both run Zotonic.\nOther WebSub subscribers and hubs can participate, but Zotonic&#39;s resource importer\nrequires its resource-export JSON schema. This module does not import arbitrary\nRSS, Atom or HTML documents as resources.<\/p>\n<h2>Getting started<\/h2>\n<ol><li>Enable <code>mod_websub<\/code> on the publishing and importing Zotonic sites.<\/li><li>On the importing site, import the original resource and explicitly select\nautomatic updates in the import dialog.<\/li><li>Choose how deeply to import connections. Select <strong>Also subscribe to connected\nresources<\/strong> if those resources should receive their own updates as well.<\/li><li>Check the imported resource&#39;s automatic-update status. A subscription becomes\nactive only after the publisher verifies the callback, not merely after it\naccepts the request.<\/li><\/ol>\n<p>Use the resource editor&#39;s controls to start or stop updates. Stopping disables\nlocal automatic imports immediately and schedules remote unsubscription.\n<strong>Content → WebSub subscriptions<\/strong> provides an overview of incoming subscribers\nand outgoing subscriptions, including errors and a retry action.<\/p>\n<h2>Configuration and usage<\/h2>\n<p>Settings are per site under <code>mod_websub<\/code> in module configuration:<\/p>\n<table class=\"table\"><thead><tr><th>Key<\/th><th>Default<\/th><th>Valid range (seconds)<\/th><th>Purpose<\/th><\/tr><\/thead><tbody><tr><td><code>subscription_retry_timeout<\/code><\/td><td><code>604800<\/code> (one week)<\/td><td>1–2147483647<\/td><td>Overall retry budget for subscription discovery, verification and unsubscription.<\/td><\/tr><tr><td><code>push_quiet_seconds<\/code><\/td><td><code>10<\/code><\/td><td>0–86400<\/td><td>Quiet period after changes before publishing.<\/td><\/tr><tr><td><code>push_deadline_seconds<\/code><\/td><td><code>300<\/code><\/td><td>1–86400<\/td><td>Maximum batching delay from the first queued update.<\/td><\/tr><\/tbody><\/table>\n<p>Missing or invalid settings use their defaults. For example:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-erlang\">m_config:set_value(mod_websub, push_quiet_seconds, 10, Context).\n<\/code><\/pre>\n<p>Newer changes restart the quiet period, but not the original batching deadline.\nEach delivery contains the latest complete resource. These settings bound batching,\nnot network delivery time or retry delays. When <code>mod_presence<\/code> is active, fresh\nediting heartbeats can defer publication within the same deadline; without it,\nordinary quiet-time batching applies.<\/p>\n<h3>Permissions and administration<\/h3>\n<p>Subscribers must be allowed to view the original resource. Public resources permit\nanonymous subscriptions; private subscriptions require explicit HTTP authorization\nand current resource access. Browser login cookies alone are insufficient. A private\nsubscription authorizes delivery of the full JSON content to the verified callback.<\/p>\n<p><code>use mod_websub<\/code> controls access to the subscription overview. Local status, start\nand stop operations require resource edit permission. The overview can filter by\ndirection, local resource ID, remote hostname, state and errors. It exposes no\ncallback URLs, secrets or tokens. Resource edit pages show incoming subscriber\ncounts and automatic-update controls. See <code>m_websub<\/code> for the model and Erlang APIs.<\/p>\n<h3>Collections and connected resources<\/h3>\n<p>The saved connection depth and filters control which edges are synchronized.\nPublisher edge insertion, deletion and reordering trigger updates even without a\nresource edit. Newly referenced resources are imported after commit; existing\nimported members are reused rather than refreshed by a collection delivery.<\/p>\n<p>The optional <code>is_subscribe_connections<\/code> setting defaults to false. When enabled,\nconnected resources across all predicates receive independent subscriptions within\nthe saved depth, including later additions. Removing a connection or stopping the\nparent does not stop those subscriptions. Stop them on the individual resources.\nManual deletions remain respected unless the saved import options explicitly allow\nre-importing deleted resources. The README describes the full collection lifecycle.<\/p>\n<h2>Subscription and delivery behavior<\/h2>\n<p>The subscriber discovers the source&#39;s hub and JSON topic, records intent, and\nrequests a subscription. The publisher verifies a unique callback before activating\nit. Deliveries carry the full JSON representation with an HMAC-SHA256 signature.\nThe receiver validates the callback and signature, queues import work, and\nacknowledges promptly. Public imports consume the signed export; credentialed\nimports refetch with the editor&#39;s source credentials. Source identity and current\npermissions are checked again inside the import transaction.<\/p>\n<p>Renewal rediscovers the source and rotates the callback and secret. The previous\ncallback remains active until the replacement verifies. Confirmation schedules a\ncatch-up fetch to recover missed updates. Stopping immediately disables local\nimports, even while remote unsubscription is pending.<\/p>\n<p>Subscription failures and unanswered verification back off from 10 seconds to\n12 hours within the configured retry budget. The budget survives restarts; renewal,\nunsubscription and explicit retries start a fresh budget. Exhausted attempts stop\nwith <code>retry_timeout<\/code>; a previous confirmed lease remains valid until expiry.\nSettings are read when work runs, so changing the budget does not immediately wake\nsleeping retries or restart exhausted attempts.<\/p>\n<p>Notification delivery has a separate, fixed retry window: one week from the first\nattempt, never beyond lease expiry. Delays are 5, 20, 45 minutes and so on, capped\nat 12 hours. Newer queued versions preserve that window. Exhaustion discards the\nnotification and records <code>retry_timeout<\/code>, but preserves the lease; later resource\nupdates can start a new delivery window. Import queues and feed polling are not\ncontrolled by <code>subscription_retry_timeout<\/code>.<\/p>\n<h2>Identity and interoperability<\/h2>\n<p>A resource&#39;s identity remains its language-less <code>m_rsc:uri\/2<\/code>, such as <code>\/id\/name<\/code>.\nImports retain it as their resource <code>uri<\/code> and subscription <code>source_uri<\/code>. The fixed\nJSON WebSub topic is stored separately in <code>topic_url<\/code>; it never replaces the\nsemantic identity.<\/p>\n<p>Discovery links advertise the JSON topic as <code>rel=self<\/code> and the hub as <code>rel=hub<\/code>.\nAuthoritative resource exports also include optional <code>websub.hub<\/code> and <code>websub.topic<\/code>\nJSON convenience fields. External peers can use standard discovery and form fields\nwithout those extensions. Deliveries are complete <code>application\/json<\/code> representations,\nnot private change notices. The delivery&#39;s <code>result.uri<\/code> identifies the resource;\nits Link self identifies the topic.<\/p>\n<p>Only authoritative resources publish. Imported copies do not advertise a local\nhub or relay updates as a new source. For A → B → C, C should subscribe to A rather\nthan B&#39;s imported copy. Local self-subscriptions are rejected. The README explains\nthird-party interoperability, topic migration and circular-subscription boundaries.<\/p>\n<h2>Security and deployment<\/h2>\n<p>Outbound requests use verified TLS and explicit redirect handling. Destinations\nare checked on every hop; private, loopback, link-local and reserved addresses are\nrejected. Development <code>.test<\/code> peers may use loopback\/private addresses and\nself-signed TLS. Other destinations retain the normal checks. HTTPS downgrades are\nrefused, and cross-origin GET redirects drop credentials for the rest of the chain.<\/p>\n<p>Subscriber callbacks must use DNS hostnames; IP literals are rejected by Zotonic&#39;s\nlocal policy. Callback verification and delivery are anonymous. <code>mod_oauth2<\/code>\nconsumer tokens can authenticate source fetches and the source&#39;s same-origin hub,\nusing the original HTTPS URL and subscribing user. Token lookup and renewal remain\nowned by <code>mod_oauth2<\/code>; current group restrictions are preserved for delivery access.<\/p>\n<p>DNS validation is currently a preflight check, not connection-address pinning.\nDNS rebinding between validation and connection remains an open limitation.<\/p>\n<p>Hub admission deduplicates pending requests and bounds each site to 120 new\nverification tasks per minute and 1000 queued tasks. Limits are serialized in the\ndatabase across nodes; overload returns 503 before accepting work. Imports recheck\nidentity and permissions under the resource lock, and disabled users cannot continue\nautomatic subscription work.<\/p>\n<h2>Implementation and lifecycle<\/h2>\n<p><code>controller_websub<\/code> handles hub requests, verification and deliveries;\n<code>controller_websub_topic<\/code> serves the fixed JSON representation. Resource-header and\nexport observers advertise discovery links, import observers apply explicit\nsubscription choices, and resource\/edge observers queue publication.<\/p>\n<p><code>m_websub<\/code> provides checked APIs and queue processing. Subscription intent, leases,\nretry state and work queues persist in the database. A per-site server tracks a\ndirty flag and next due time; second ticks avoid database work while idle. A unique,\nmonitored sidejob processes due work. Signals are sent after transaction commit,\nten-minute scans reconcile persisted work, and daily maintenance cleans up records.<\/p>\n<p>Separate export revisions advance for resource and edge changes without changing\nthe resource&#39;s edit version for edge-only updates. Schema upgrades preserve queues\nand identity. The README contains wire examples, storage details, operational limits\nand regression-test commands.<\/p>","slug":"mod_websub","doc_module_config":[{"default":"604800","description":"Overall subscription and unsubscription retry time from the first attempt, in seconds (1-2147483647; default one week).","has_default":true,"key":"subscription_retry_timeout","module":"mod_websub","type":"integer"},{"default":"10","description":"Seconds without resource changes before pushing updates (0-86400).","has_default":true,"key":"push_quiet_seconds","module":"mod_websub","type":"integer"},{"default":"300","description":"Maximum batching delay from the first queued update, in seconds (1-86400).","has_default":true,"key":"push_deadline_seconds","module":"mod_websub","type":"integer"}],"is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"b62a1ec8bd9842e8f4f75b90072b189c3e9c4d03c2cb12622e24a1133061ee32","is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"category_id":{"id":320,"is_a":["meta","category"],"name":"module","title":"Modules","uri":"https:\/\/test.zotonic.com\/id\/320"},"doc_source_path":"apps\/zotonic_mod_websub\/src\/mod_websub.erl","publication_start":"2026-09-29T13:07:37Z","github_url":"https:\/\/github.com\/zotonic\/zotonic\/blob\/master\/apps\/zotonic_mod_websub\/src\/mod_websub.erl","pivot_location_lng":null,"doc_source_kind":"module","name":"doc_module_mod_websub","is_unfindable":false,"is_published":true,"pivot_geocode":null,"created":"2026-09-29T13:07:37Z","uri":null,"doc_status":"current","is_dependent":false,"erlang_app":"zotonic_mod_websub","publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"fdb910ac3335e4c32f712a9a29c250325d4488e0\n","creator_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"modified":"2026-11-27T21:34:02Z","title_slug":"mod_websub"},"uri":"https:\/\/zotonic.com\/id\/2703","uri_template":"https:\/\/zotonic.com\/id\/:id","version":274,"websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/2703"}},"status":"ok"}