Repository is archived
No commit activity in last 3 years
No release in over 3 years
Delayed Redis engine backend for Faye
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0
>= 0
>= 0
>= 0

Runtime

>= 0
>= 0.2.0
 Project Readme

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