Browse Source

move docs to separate doc page

Aaron Parecki 5 years ago
No known key found for this signature in database GPG Key ID: 276C2817346D6056
3 changed files with 68 additions and 15 deletions
  1. +10
  2. +54
  3. +4

+ 10
- 1
controllers/controllers.php View File

@ -3,7 +3,16 @@
$app->get('/', function() use($app) {
$res = $app->response();
$html = render('index', array(
'title' => 'Switchboard',
'title' => 'Switchboard - a PubSub Hub',
'meta' => ''
$app->get('/docs', function() use($app) {
$res = $app->response();
$html = render('docs', array(
'title' => 'Switchboard Documentation',
'meta' => ''

+ 54
- 0
views/docs.php View File

@ -0,0 +1,54 @@
<div class="narrow">
<div class="jumbotron">
<h1><a href="/"><img src="/images/switchboard-logo.png" height="72" style="margin-bottom: 13px;" class="" alt="logo"></a> Switchboard</h1>
<p>To publish content using Switchboard as your hub, add the following tags to your HTML feeds:</p>
<p><pre>&lt;link rel="self" href=""&gt;
&lt;link rel="hub" href=""&gt;</pre></p>
<p>When you add a new item to the feed, send a POST request to <code></code> with the following
<p>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.</p>
<p>If you are subscribing to a feed that uses Switchboard as its hub, here is what you can expect.</p>
<p>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:</p>
<li><code>hub.topic=</code> the topic URL that you requested to subscribe to</li>
<li><code>hub.challenge=</code> a random string that you will need to echo to confirm the subscription</li>
<li><code>hub.lease_seconds=</code> the number of seconds this subscription will remain active</li>
<p>To confirm the subscription, you will need to respond with <code>HTTP 200</code> and the body of the response must be exactly equal to the challenge string. Any other response will not activate your subscription.</p>
<p>When there is new content available from the topic URL, Switchboard will send a POST request to your callback URL.</p>
<p>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.</p>

+ 4
- 14
views/index.php View File

@ -3,23 +3,13 @@
<div class="jumbotron h-x-app">
<h1><img src="/images/switchboard-logo.png" height="72" style="margin-bottom: 13px;" class="u-logo p-name" alt="Switchboard"> Switchboard</h1>
<p class="tagline p-summary">Switchboard is a PubSubHubbub 0.4 hub.</p>
<p class="tagline p-summary">Switchboard is a PubSub hub.</p>
<p>To publish content using Switchboard as your hub, add the following links to your home page:</p>
<p><pre>&lt;link rel="self" href=""&gt;
&lt;link rel="hub" href=""&gt;</pre></p>
<p><a href="/docs">Switchboard Documentation</a></p>
<p>Then, send a POST request to <code></code> with the following
parameters every time you add content to your home page:</p>
<p><a href="">PubSub Spec</a></p>
<p>Read more info about <a href="">how to publish and consume using PubSubHubbub</a>.</p>
<p>Read more about <a href="">how to publish and consume using PubSub</a>.</p>
<a href="<?= Config::$base_url ?>/" class="u-url"></a>