Giter Site home page Giter Site logo

snrub's Introduction

snrub logo

PuSH subscriber as Connect middleware

This module provides a PuSH (pubsubhubbub) subscriber. This is a object with methods for subscribing to, and unsubscribing from, topics on PuSH hubs.

The object gives you a middleware you can use with Connect or Express; provided you host it somewhere suitably accessible via HTTP, it will then accept HTTP updates from the hubs and emit them as events.

var subscriber = require('snrub')
  .createSubscriber({'host': 'example.com:8000'});
var app = connect(subscriber.middleware());

subscriber.subscribe('http://pubsubhubbub.appspot.com', // hub
                     'http://blog.cloudfoundry.com/feed');
subscriber.on('subscribe', function(topic) {
  console.log("Subscribed to " + topic;)
});
subscriber.on('update', function(topic, content) {
  console.log("Content from " + topic);
  console.log(content);
});

app.listen(8000); // pretending we are on host example.com

A demo is available at http://snrub-demo.cloudfoundry.com/.

snrub's People

Contributors

squaremo avatar magicmark avatar

Stargazers

 avatar Cat  avatar Julien Genestoux avatar Chad Lung avatar J. J. Knudsen avatar  avatar Diego Marcos avatar Ian Anderson avatar Lawrence Carvalho avatar

Watchers

 avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.