Skip to content

Instantly share code, notes, and snippets.

@sreeix
Created May 31, 2011 13:54
Show Gist options
  • Save sreeix/1000534 to your computer and use it in GitHub Desktop.
Save sreeix/1000534 to your computer and use it in GitHub Desktop.
Subscription for the users timeline fetch
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