Created
May 31, 2011 13:54
-
-
Save sreeix/1000534 to your computer and use it in GitHub Desktop.
Subscription for the users timeline fetch
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 'json' | |
redis = Redis.new | |
redis.subscribe(:vsagarv_channel) do |on| | |
on.subscribe do |channel, subscriptions| | |
puts "Subscribed to ##{channel} (#{subscriptions} subscriptions)" | |
end | |
on.message do |channel, message| | |
puts "##{channel}: #{message}" | |
message = JSON.parse(message) | |
if(message['status'] == 'timeline_fetched') | |
puts message['timeline_path'] | |
redis.unsubscribe | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment