Installing
Install and add to your package.json
dependencies:
npm install --save superfeedr-pshb
Usage
// Vanilla JS:var Superfeedr = default // ES6:
Initialize and hook callback handler
First, create the client instance:
var superfeedr = superfeedr_user superfeedr_password "http://me.example.com:8080/.pshb"
The last parameter is the URL remote hubs use to connect back to you. For this to work, you must hook the PSHB request handler into your HTTP server.
http
Event 'notification'
Deal with it:
superfeedr
superfeedr.subscribe(url, cb)
Subscribe a feed, calls back cb(error, info)
superfeedr.unsubscribe(url, cb)
Unsubscribe a feed, calls back cb(error, info)
superfeedr.list(opts, cb)
List feeds, calls back cb(error, info)
superfeedr.streamSubscriptions(opts)
Joins the superfeedr.list()
pages into a continuous stream of
subscription objects.
superfeedr.retrieve(qs, cb)
Retrieve the last entries,
calls back cb(error, result)
Running the examples and tests
Configuration is accomplished using these environment variables:
SUPERFEEDR_USER
andSUPERFEEDR_PASSWORD
(credentials)- PSHB_HOST (public IP address, optionally with port) and PSHB_PORT (HTTP listen port)