Created
January 19, 2010 15:11
-
-
Save nmerouze/280989 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'vendor/gems/environment' | |
require 'cramp/controller' | |
require 'uuid' | |
require 'mq' | |
Cramp::Controller::Websocket.backend = :thin | |
class TweetsController < Cramp::Controller::Websocket | |
end | |
Rack::Handler::Thin.run TweetsController, :Port => 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'vendor/gems/environment' | |
require 'cramp/controller' | |
require 'uuid' | |
require 'mq' | |
Cramp::Controller::Websocket.backend = :thin | |
class TweetsController < Cramp::Controller::Websocket | |
@@uuid = UUID.new | |
on_start :display | |
def display | |
puts "WebSocket opened" | |
twitter = MQ.new | |
twitter.queue(@@uuid.generate).bind(twitter.fanout('twitter')).subscribe do |t| | |
render t | |
end | |
end | |
end | |
Rack::Handler::Thin.run TweetsController, :Port => 3000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'vendor/gems/environment' | |
require 'cramp/controller' | |
require 'uuid' | |
require 'mq' | |
Cramp::Controller::Websocket.backend = :thin | |
class TweetsController < Cramp::Controller::Websocket | |
@@uuid = UUID.new | |
on_start :display | |
on_finish :close | |
def display | |
puts "WebSocket opened" | |
twitter = MQ.new | |
twitter.queue(@@uuid.generate).bind(twitter.fanout('twitter')).subscribe do |t| | |
render t | |
end | |
end | |
def close | |
puts "WebSocket closed" | |
end | |
end | |
Rack::Handler::Thin.run TweetsController, :Port => 3000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment