Skip to content

Instantly share code, notes, and snippets.

@belison
Created August 13, 2012 19:30
Show Gist options
  • Save belison/3343489 to your computer and use it in GitHub Desktop.
Save belison/3343489 to your computer and use it in GitHub Desktop.
Figure 6: final faye.ru with SSL and extentions
require ::File.expand_path('../config/environment', __FILE__)
require 'faye'
require 'faye/redis'
require 'yaml'
faye_config = YAML.load_file(Rails.root.join('config','faye.yml'))[Rails.env]
redis_config = YAML.load_file(Rails.root.join('config','redis_store.yml'))[Rails.env]
redis_uri = URI.split(redis_config)
Faye::Logging.log_level = :debug
faye = Faye::RackAdapter.new(
:host => faye_config['host'],
:mount => "/#{faye_config['mount']}",
:timeout => faye_config['timeout'],
:engine => {
:type => Faye::Redis,
:host => redis_uri[2],
:port => redis_uri[3]
}
)
faye.add_extension(Publisher::FayeAuth.new)
if Rails.env == 'development'
faye.listen(faye_config['port'])
else
faye.listen(
faye_config['port'],
{:key => faye_config['key'],
:cert => faye_config['cert']}
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment