Dynamic Tracking #94

billeisenhauer opened this Issue Aug 5, 2012 · 3 comments

4 participants


Say you start tracking the stream for one keyword; perhaps #olympics. Then, for whatever reason, you want to add #lolo to the tracking list. So basically, you want to change your tracked terms dynamically. And you don't want to miss any tweets from your original tracking.

What's the best way to do this? If you kill your current connection and then reinitiate tracking with the compound list, do you risk missing tweets? Or, would you initiate a second connection with the compound list and count on Twitter to kill off your first connection?

This is an edge case, but I have a need for it, so would like to get your take on how you might approach it.

TweetStream member

I am going to add better support for this very soon, but in the meantime it's possible, have a look through some relevant discussion in #22, particularly this example


Hi guys,

Just read the closed ticket #22, which is 3 years old but pointed me in the right direction. I am doing the following to update my tracking hashtags:

    EM.run do
        track = getnewtracker
        twitter = TweetStream::Daemon.new('tracker')

        twitter.track(*track) do |status|
            # do something with the tweet


        EM.add_periodic_timer(60) do
            track = getnewtracker
            twitter.stream.update(:params=>{:track => track})

I keep getting reconnects every 60 seconds, the reason of course is the EM timer.
Do I risk loosing tweets this way? It seems to me that might be possible.
Is there any other (new) way to update the tracker without disconnecting and without loosing any tweets?


Still relevant. Is there a way to add additional keywords to the daemon dynamically?

@stve , I was browsing through your example (https://github.com/tweetstream/tweetstream-rails-example) and it works great. However I do need to add the keywords dynamically, and reloading the daemon is not a suitable option since I will most certainly miss tweets during the daemons down-time.

Do you think there's a chance that this will be in development any time soon?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment