To publish content using Switchboard as your hub, add the following tags to your HTML feeds:
<link rel="self" href="https://example.com/"> <link rel="hub" href="https://switchboard.p3k.io/">
When you add a new item to the feed, send a POST request to https://switchboard.p3k.io/
with the following parameters:
hub.mode=publish
hub.url=https://example.com/
Switchboard will fetch your page to confirm that it has changed since it last sent notifications, and then will send notifications to every active subscriber. The request that Switchboard sends to your subscribers will be a POST request, and the body will be the full contents of your page. This is known as a "fat ping". Your subscribers can parse the body of the notification the same way they would parse your page, or they might request your page directly to find updates.
If you are subscribing to a feed that uses Switchboard as its hub, here is what you can expect.
When you first request the subscription, Switchboard will send a verification request to your callback URL. The verification request will be a GET request to your callback URL with the following query parameters:
hub.mode=subscribe
hub.topic=
the topic URL that you requested to subscribe tohub.challenge=
a random string that you will need to echo to confirm the subscriptionhub.lease_seconds=
the number of seconds this subscription will remain activeTo confirm the subscription, you will need to respond with HTTP 200
and the body of the response must be exactly equal to the challenge string. Any other response will not activate your subscription.
When there is new content available from the topic URL, Switchboard will send a POST request to your callback URL.
The POST request body will be the exact contents available at the topic URL. Switchboard fetches the HTML immediately so this value can be guaranteed to be "fresh" and not cached. You can parse this body the same way you would have parsed the contents of fetching the topic URL itself. The content type of the request will match the content type of the topic URL.