Skip to content

Instantly share code, notes, and snippets.

@kapkaev
Forked from pirj/Gemfile
Created February 3, 2013 08:19
Show Gist options
  • Save kapkaev/4700935 to your computer and use it in GitHub Desktop.
Save kapkaev/4700935 to your computer and use it in GitHub Desktop.
require 'bundler'
Bundler.require
class App < Sinatra::Base
helpers Sinatra::Streaming
get '/' do
subscriber = EM::Hiredis.connect
subscriber.psubscribe '*'
stream :keep_open do |out|
subscriber.on(:pmessage) do |key, channel, message|
subscriber.punsubscribe '*' if out.closed?
out << "#{key}, #{channel}, #{message}" unless out.closed?
end
end
end
end
source 'https://rubygems.org'
gem 'sinatra'
gem 'sinatra-contrib', require: 'sinatra/streaming'
group :development do
gem 'thin'
gem 'pry-rails'
end
gem 'eventmachine', "= 1.0.0.rc.4"
gem "redis", "~> 3.0"
gem "hiredis", "~> 0.4.5"
gem 'em-hiredis'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment