Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
81 lines (48 sloc) 2.12 KB


Pusher guard allows to automatically send a Pusher message to any number of browserswhen files are modified. That message can for instance be used to reload a page during development. Sort of Livereload but for iPad, iPhone etc. without the ability to install the necessary extension.

  • Tested on Ruby 1.8.7 & 1.9.2.


Please be sure to have Guard installed before continue.

Install the gem:

gem install guard-pusher

Or add it to your Gemfile

gem 'guard-pusher'

and run

bundle install

Add guard definition to your Guardfile by running this command:

guard init pusher

Get a free Pusher developer account: (also available as Heroku add-on).

Create a YAML file containing your API credentials for the development environment and save it in the config directory:

# config/pusher.yml
  app_id: ...
  key: ...
  secret: ...

You can also pass these credentials as option in your guard definition, see Options below.

Include the following JavaScript:

<script src=""></script>
    new Pusher(<key>).subscribe('guard-pusher').bind('guard', function() {
        // do something - for instance simply reload the page:


Please read Guard usage doc


Pass Pusher API credentials as option:

guard 'pusher', :app_id => ..., :key => '...', :secret => '...' do

Set the name of the event you're binding to:

guard 'pusher', :event => 'ping' do

new Pusher(...).subscribe('guard-pusher').bind('ping', function() { ... });


Pull requests are very welcome! Make sure your patches are well tested. Please create a topic branch for every separate change you make.


Klaus Hartl