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 @@ +
+ +
+

logo Switchboard

+ +

Publishing

+ +

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:

+ +

+

+

+ +

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.

+ + + +

Subscribing

+ +

If you are subscribing to a feed that uses Switchboard as its hub, here is what you can expect.

+ +

Verification

+ +

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:

+ +

+

+

+ +

To 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.

+ +

Notifications

+ +

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.

+ + +
+ +
diff --git a/views/index.php b/views/index.php index c48719c..a1777d3 100644 --- a/views/index.php +++ b/views/index.php @@ -3,23 +3,13 @@

Switchboard

-

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/">

+

Switchboard Documentation

-

Then, send a POST request to https://switchboard.p3k.io/ with the following - parameters every time you add content to your home page:

+

PubSub Spec

-

-

-

- -

Read more info about how to publish and consume using PubSubHubbub.

+

Read more about how to publish and consume using PubSub.