diff --git a/controllers/controllers.php b/controllers/controllers.php index fc84960..a52d4a4 100644 --- a/controllers/controllers.php +++ b/controllers/controllers.php @@ -3,7 +3,16 @@ $app->get('/', function() use($app) { $res = $app->response(); $html = render('index', array( - 'title' => 'Switchboard', + 'title' => 'Switchboard - a PubSub Hub', + 'meta' => '' + )); + $res->body($html); +}); + +$app->get('/docs', function() use($app) { + $res = $app->response(); + $html = render('docs', array( + 'title' => 'Switchboard Documentation', 'meta' => '' )); $res->body($html); diff --git a/views/docs.php b/views/docs.php new file mode 100644 index 0000000..0b0429c --- /dev/null +++ b/views/docs.php @@ -0,0 +1,54 @@ +
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.topic=https://example.com/
Switchboard will send notifications to every subscriber that your feed has been updated. The request that Switchboard sends to your subscribers will be a POST request with no body. This is known as a "thin ping". Your subscribers will then request your feed 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.
+ +This POST request will have no body, and is meant to be an indication that the URL has been updated, and that you can fetch the new contents from there.
+ + +Switchboard is a PubSubHubbub 0.4 hub.
+Switchboard is a PubSub hub.
-To publish content using Switchboard as your hub, add the following links to your home page:
-<link rel="self" href="https://example.com/"> -<link rel="hub" href="https://switchboard.p3k.io/">+ -
Then, send a POST request to https://switchboard.p3k.io/
with the following
- parameters every time you add content to your home page:
-
hub.mode=publish
hub.topic=https://example.com/
Read more info about how to publish and consume using PubSubHubbub.
+Read more about how to publish and consume using PubSub.