How to stop streaming


#1

Hi!

I’m developing an iOS application using the twitter streaming with OAuth. Users can make as many requests as they want, but after starting one streaming (making connection with https://stream.twitter.com/1/statuses/filter.json), if the user wants to start a new one, with other tracking words, I receive both streamings at the same time.

How can I stop the first streaming to start the new one?

Thank you very much in advance!!!

Any answer will be appreciated.


#2

I have exactly the very same problem. I need to stop a current streaming to begin a new one.
Anybody can help me?

Thanks!!


#3

Same problem here, any help?


#4

How are each of you opening the initial connection? Are you using any 3rd party network libraries?


#5

Hi!! Thank you for the answer!

I’m using OAuth for iOS. For each request of streaming I’m executing this request:
"https://stream.twitter.com/1.1/statuses/filter.json?track=search_filters"
So when I want to start new streaming, I execute the same request but changing the track filters. Doing this I get 2 different streamings at the same time, not a good thing…

Thanks in advance!!!


#6

I do the same that @antonialorem: OAuth for iOS.

Thanks Sean (and Antonia)


#7

Hi Sean:

Tt seems to work properly when the hashtag is popular. For example, if I look for “BonJovi” the streaming doesn’t stop. But when the hashtag is not that famous, it stops.

The Streaming Works When the Query is with a very Popular Hashtag.

Does it help?


#8

Hi Javier

Actually the streaming doesn’t stop, Its just that running code does not receive any tweets since there are not people tweeting about the keyword.
I wonder if there is any way to gracefully close the streaming connection and open a new one. I am doing sentiment analysis of tweets and I run my python code from command line. I could not find a way to stop my code other than to break it abruptly (CTRL+c) which is not a good thing.

Hi Sean,
I am using tweepy(python library) to open a new connection to streaming API
stream.filter(track=[sys.argv[1]], encoding=‘utf-8’)
like so


#9

Hi Guys,

I know this is an old topic but just wanted to bring it to your attention or i am not sure that someone connected to this topic have resolved this issue or not :smile:

I have been working with Twitter Streaming API and I wanted to close the stream so that new track value can be given. I have been working in C# and ASP.NET MVC Angular project.

I have achieved this by run the stream in a separate thread in c#. and when i want to close the stream I am just setting the value of local variable to false. So when running stream encounters that variable it is stopping the stream.

Thanks

Eman


#10

I was facing this problem too. What eventually worked for me was stream.stop().

.destroy(), .disconnect() etc brought up a variety of errors such as .destroy is not defined.