Delayed Redis engine backend for Faye
Ruby
Latest commit c13c93e Apr 9, 2015 @chytreg chytreg Bump version to 0.0.3
Permalink
Failed to load latest commit information.
lib Removed comment Apr 9, 2015
spec Specs May 17, 2014
.gitignore Initial commit Oct 30, 2013
.rspec Specs May 17, 2014
Gemfile Initial commit Oct 30, 2013
LICENSE.txt Update and rename LICENSE to LICENSE.txt Dec 23, 2013
README.md Added :delay_channels list to configs Mar 24, 2015
Rakefile Initial commit Oct 30, 2013
faye-redis-delayed.gemspec Bump version to 0.0.3 Apr 9, 2015

README.md

Faye::RedisDelayed Gem Version Circle CI

Delayed Redis engine back-end for Faye Ruby server. Enables delivey of messages that were sent before a client has connected to the channel.

Turn this timeline:

Regular faye

…into that:

RedisDelayed faye

You can read about the real case scenario for the engine.

Installation

Add this line to your application’s Gemfile:

gem 'faye-redis-delayed'

Usage

When initializing a new Faye server, reference the engine and pass any required settings.

# faye config.ru
require 'faye'
require 'faye/redis_delayed'

server = Faye::RackAdapter.new(
  :mount   => '/',
  :timeout => 25,
  :engine  => {
    :type   => Faye::RedisDelayed,  # set the engine type
    :expire => 30                   # undelivered messages will expire in 30 seconds
    # …                             # other Faye::Redis engine options
  }
)

run server

Additional options provided by Faye::DelayedRedis:

  • :expire — expire time in seconds, defaults to 60
  • :delay_channels - Array of channels that should be delayed

:delay_channels can be specified as strings or as regular expressions. If something is given, then only channels matching one of the listed patterns will be delayed. Without this argument, every channel is delayed.

  :engine  => {
    :type           => Faye::RedisDelayed,
    :delay_channels => [/^\/queues_with_this_prefix/, "/this/one/queue"],
  }

See the full list of Faye::Redis engine options.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request