Skip to content
This repository has been archived by the owner on Jun 5, 2020. It is now read-only.

monterail/faye-redis-delayed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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