Requires stanza.io version 6.6.x
or greater.
var client = require('stanza.io').createClient({
jid: '[email protected]',
password: 'hunter2'
});
client.use(require('stanza.io-superfeedr'));
client.connect();
// ...
// 1. Add feed
client.superfeedrAddFeed('http://domain.tld/feed1.xml');
client.superfeedrAddFeed({
feed: 'http://domain.tld/feed1.xml',
jid: '[email protected]',
format: 'json'
}, function (err, res) {
// do stuff
});
// 2. Remove feed
client.superfeedrRemoveFeed('http://domain.tld/oldfeed.xml');
client.superfeedrRemoveFeed({
feed: 'http://domain.tld/oldfeed.xml',
jid: '[email protected]'
}, function (err, res) {
// do stuff
});
// 3. List feeds
client.superfeedrListFeeds(client.jid, 2, function (err, res) {
if (err) {
console.log(err.error);
return;
}
console.log(res.pubsub.subscriptions.list);
});
// 4. Retrieve entries
client.superfeedrRetrieveEntries('http://domain.tld/feed1.xml', function (err, res) {
if (err) {
console.log(err.error);
return;
}
console.log(res.pubsub.retrieve.items);
});