No commit activity in last 3 years
No release in over 3 years
A PubSubHubbub server conforming to the v0.4 spec, mountable from a Rails app
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 2.0
~> 1.4
>= 5.0.0.1, ~> 5.0.0
 Project Readme

Pubsubhubbub

Gem Version Dependency Status

This is a mountable PubSubHubbub server conforming to the v0.4 of the spec.

Usage

In routes.rb:

mount Pubsubhubbub::Engine, at: 'pubsubhubbub', as: :pubsubhubbub

In feed:

<link rel="hub" href="<%= pubsubhubbub_url %>" />

If you want to override topic verification (which is done before subscribe/unsubscribe events to confirm that the topic is in fact using the hub), you can add a custom initializer, e.g. config/initializers/pubsubhubbub.rb:

Pubsubhubbub.verify_topic = lambda { |topic_url| topic_url == 'http://mysite.com/my-feed' }

You can also override the fetching of the topic when it is updated, for example if it's generally not publicly accessible or if you generate the feed from the Rails app where you mounted the hub.

Pubsubhubbub.render_topic = lambda { |topic_url| FeedsController.render(:show) }

If you want to notify the subscribers without hitting the /pubsubhubbub HTTP endpoint, there's a convenience method you can use right from your app:

Pubsubhubbub.publish(pubsubhubbub_url, feed_url(user))

Installation

Add this line to your application's Gemfile:

gem 'pubsubhubbub-rails', require: 'pubsubhubbub'

And then execute:

$ bundle

Or install it yourself as:

$ gem install pubsubhubbub-rails

License

The gem is available as open source under the terms of the MIT License.