No commit activity in last 3 years
No release in over 3 years
Eventmachine-based Twitter Userstream client
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 0.12.10
>= 0
>= 0
>= 0.4.0
>= 0.7.5
 Project Readme

Userstream¶ ↑

About¶ ↑

This is an experimental EventMachine-based client for userstream.twitter.com.

Fun Things You Can Do At Home¶ ↑

Fire up the growl client!

sudo gem install twitter-userstream
usr_stream_growl

Wow! It’s growling my tweets! How meta.

Usage¶ ↑

require 'rubygems'
require 'userstream'
require 'rainbow'

usr_stream = Userstream.new
usr_stream.on_reconnect{ puts "reconnecting..." }
usr_stream.on_tweet {|t, u| puts "#{t.text} (from #{t.user.name.foreground(:red)} (#{('@' + t.user.screen_name).foreground(:green)}))" }
usr_stream.on_follow {|t, u| puts "#{t.source.screen_name.foreground(:green)} following #{t.target.screen_name.foreground(:green)}" }
usr_stream.on_favorite {|t, u| puts "#{t.source.screen_name.foreground(:green)} <3 -> #{t.target_object.text}" }
usr_stream.on_retweet {|t, u| puts "#{t.source.screen_name.foreground(:green)} RT -> #{t.target_object.text}" }
usr_stream.on_direct_message {|t, u| puts "DM : #{t.text} (from #{t.sender.name.foreground(:red)} (#{('@' + t.sender.screen_name).foreground(:green)}))" }
usr_stream.connect(Userstream::Connect::User.basic('joshbuddy', 'xxxxxxxx'))

Oauth Usage¶ ↑

usr_stream = Userstream.new(:consumer_token => consumer_token, :consumer_secret => consumer_secret)
usr_stream.on_reconnect{ puts "reconnecting..." }
usr_stream.on_tweet {|t, u| puts "#{t.text} (from #{t.user.name.foreground(:red)} (#{('@' + t.user.screen_name).foreground(:green)}))" }
usr_stream.on_follow {|t, u| puts "#{t.source.screen_name.foreground(:green)} following #{t.target.screen_name.foreground(:green)}" }
usr_stream.on_favorite {|t, u| puts "#{t.source.screen_name.foreground(:green)} <3 -> #{t.target_object.text}" }
usr_stream.on_retweet {|t, u| puts "#{t.source.screen_name.foreground(:green)} RT -> #{t.target_object.text}" }
usr_stream.on_direct_message {|t, u| puts "DM : #{t.text} (from #{t.sender.name.foreground(:red)} (#{('@' + t.sender.screen_name).foreground(:green)}))" }
usr_stream.connect(Userstream::Connect::User.oauth(access_token, access_secret))

Multi User Usage¶ ↑

usr_stream = Userstream.new(:consumer_token => consumer_token, :consumer_secret => consumer_secret)

usr_stream.on_reconnect{ puts "reconnecting..." }
usr_stream.on_tweet {|t, u| puts "#{t.text} (from #{t.user.name.foreground(:red)} (#{('@' + t.user.screen_name).foreground(:green)}))" }
usr_stream.on_follow {|t, u| puts "#{t.source.screen_name.foreground(:green)} following #{t.target.screen_name.foreground(:green)}" }
usr_stream.on_favorite {|t, u| puts "#{t.source.screen_name.foreground(:green)} <3 -> #{t.target_object.text}" }
usr_stream.on_retweet {|t, u| puts "#{t.source.screen_name.foreground(:green)} RT -> #{t.target_object.text}" }
usr_stream.on_direct_message {|t, u| puts "DM : #{t.text} (from #{t.sender.name.foreground(:red)} (#{('@' + t.sender.screen_name).foreground(:green)}))" }

usr_stream.connect(Userstream::Connect::User.oauth(access_token1, access_secret1), Userstream::Connect::User.oauth(access_token2, access_secret2))