Created
August 13, 2010 03:41
-
-
Save deepfryed/522229 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
#!/usr/bin/ruby | |
require 'gems/environment' | |
require 'em-jack' | |
require 'em-http' | |
EM.run do | |
jack = EMJack::Connection.new | |
jack.use('stalk') do | |
5.times {|n| jack.put "hello #{n+1}" } | |
end | |
jack.watch('stalk') do | |
jack.each_job do |job| | |
p 'received %d' % job.jobid | |
http = EM::HttpRequest.new('http://www.google.com/').get | |
http.callback do | |
p 'http callback' | |
job.delete { p "deleted" } | |
end | |
http.errback do | |
p 'http errback' | |
job.delete { p "deleted" } | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment