0
votes

I've an application where I use twitter streaming API with status filters. I use the twitter4j client for this. The status filters are determined at runtime and they are added into a queue. On adding filters into the queue, separate thread is created which in turn spawns streaming http connection to twitter. Along with these filters, I have added "followings" field to track the tweets made by a particular user. The same twitterUserId is added as part of all threads. When the user with this twitterUserId tweets, I should ideally see all the threads fetching this tweet. But I don't see this happening always. At times only few threads see the tweet and sometimes all of them see this tweet. I see that this functionality is quite flaky. What can the issue with this?

1

1 Answers

0
votes
For general streams, you should only make one connection from the same IP.

https://dev.twitter.com/discussions/7542

As long you're connecting from the same IP address you can have only one standing connection to the public streams.

Why do you need multiple threads?

In a single stream you can filter 400 track keywords and follow 5,000 user ids.