Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

the twitter feed now uses EMJack instead of beanstalk client.

Uses beanstalk tubes
  • Loading branch information...
commit f111fb11e22edc01ee067231326a6aff25ead08f 1 parent cab6b24
@carlhoerberg authored
Showing with 7 additions and 5 deletions.
  1. +1 −0  socket.rb
  2. +6 −5 twitterfeed.rb
View
1  socket.rb
@@ -7,6 +7,7 @@
puts "WebSocket opened"
jack = EMJack::Connection.new
+ jack.watch 'twitter'
jack.each_job do |msg|
ws.send msg.body
jack.delete msg
View
11 twitterfeed.rb
@@ -1,20 +1,21 @@
require 'rubygems'
-require 'beanstalk-client'
+require 'em-jack'
require 'twitter/json_stream'
username = ARGV.shift
password = ARGV.shift
raise "need username and password" if !username or !password
-EventMachine::run {
+EventMachine::run do
stream = Twitter::JSONStream.connect(
:path => '/1/statuses/filter.json?track=iphone',
:auth => "#{username}:#{password}"
)
- bt = Beanstalk::Pool.new(['localhost:11300'])
+ jack = EMJack::Connection.new
+ jack.use 'twitter'
stream.each_item do |status|
- bt.put(status)
+ jack.put(status)
end
-}
+end
Please sign in to comment.
Something went wrong with that request. Please try again.