Trying to consume stream but getting back "Exceeded connection limit for user"


#1

I’m using the ROAuth and streamR libraries for R.

First I had trouble connecting to Twitter, see http://stackoverflow.com/questions/40362950/trying-to-connect-to-twitter-streaming-api-using-roauth-getting-error-forbidd/40363285#40363285. Then I’ve been trying to get a stream filtered to show 10 tweets mentioning “Jeremy Corbyn”; this is how I did it:

filterStream( file.name="jeremy_corbyn.json",
              track='"jeremy corbyn"', tweets=10, oauth=my_oauth )

tweets.df <- parseTweets("jeremy_corbyn.json")

At first when I tried running this, it waited for about 200 seconds. I don’t remember running the second command that time. After that, every time I’ve run it I’ve got back

Capturing tweets…
Connection to Twitter stream was closed after 1 seconds with up to 1 tweets downloaded.

and

Error in parseTweets(“jeremy_corbyn.json”) :
“jeremy_corbyn.json” did not contain any tweets. See ?parseTweets for more details.

I’ve even tried waiting 15 minutes and I get the same thing.

The contents of “jeremy_corbyn.json” are:

Exceeded connection limit for user
Exceeded connection limit for user
Exceeded connection limit for user
Exceeded connection limit for user

Why is this happening and how do I get it to work?


#2

I can’t be much help because I don’t know R - I don’t understand that language at all. But the Stream is a live data stream, so I’m not sure what your plan is for getting 10 tweets is (is the R program you’re running going to disconnect after it receives 10 tweets?). You’re tracking “jeremy corbyn”, so it depends on how often someone writes that while you’re connected to the Stream.

You can only have 1 connection to the Stream. Is it possible the first connection did not close? That would explain the “Exceeded connection limit for user” errors you were getting on subsequent connection attempts.