A PubSubHubbub server written in PHP, ready to be run on your own server.
Use it to instantly notify subscribers about updates on your blog's feed, your website's HTML pages or any other HTTP-accessible resources.
Work in progress. Basic functionality is working.
Implements PubSubHubbub 0.4.
Contents
- Subscribing to a topic
- Notifying the hub about a topic update
- Wildcard URLs supported (with
*
). All matching subscribed topics are then checked if they changed and notifications are sent out. Wildcards in domain or scheme are not allowed.
- Wildcard URLs supported (with
- Sending notifications to subscribers
- As many worker-processes as you want to speed it up
- Notifications get only sent when lease time is >= NOW()
- Notifications get only sent when the content changed. phubb uses etag, last modified and a hash on the content to check that.
- Re-pinging a subscriber when it failed (exponential back-off)
- Logging
- Re-connecting to DB if we had a timeout
- PHP
- PDO
- PHP Gearman extension
- Gearman job server,
gearman-job-server
- Monolog
Point the web server's document root to the
www/
directory.Create a new MySQL database and import the schema from
data/schema.sql
. Database host and username/password/db name can be adjusted by copyingdata/phubb.config.php.dist
todata/phubb.config.php
and adjusting it to your needs.Install dependencies:
$ composer install
Run the worker process
bin/phubb-worker.php
Let
bin/phubb-cron.php
be run by cron every minute.
The hub URL is at http://$domain/hub.php
.
Send a POST request with the following data:
hub.mode=publish hub.url=http://topic-url.example.org/
Example:
$ curl -d hub.mode=publish -d "hub.url=http://blog.example.org/feed"\ http://phubb.example.org/hub.php
or, to automatically publish all modified URLs in that path:
$ curl -d hub.mode=publish -d "hub.url=http://blog.example.org/*"\ http://phubb.example.org/hub.php
Tasks can be sent via the test-task.php
script to the worker.
Verify a subscription:
$ ./bin/test-task.php verify http://phubb.bogo/client-callback.php http://www.bogo/tagebuch/feed/ subscribe 3600 mysecret
Publish an update:
$ ./bin/test-task.php publish http://www.bogo/tagebuch/feed/
Notify subscriber:
$ ./bin/test-task.php notifysubscriber http://www.bogo/tagebuch/feed/ 1 55140a8d865a9
- stats
- require domain registration before being able to publish
- check if URL topic URL has hub link (and self link)
- do not allow subscriptions for urls that are not registered
- custom user agent when fetching URLs
phubb's source code is available from http://git.cweiske.de/phubb.git or the mirror on github.
phubb is licensed under the AGPL v3 or later.
phubb was written by Christian Weiske.