Streaming Api filter doesn't push Tweets instantly


#1

Hi,
I am working on an Application that i used Streaming API filtering for certain Hashtag (not known). once I start the streaming and start tweeting I don’t receive tweets instantly (using Apache Client), I have to tweet 5 Tweets in order to receive only 4 tweets out of 5 (1-4) then i have to 5 tweet another 5 in order to receive the other 4 tweets (5-8).
Is this a standard that is used by streaming API to send tweets by chunks? is there any alternative to use in order to get tweets instantly ??

Thanks in advance.


#2

Hmm. My understanding is that you should certainly get the updates directly rather than in batches.

Which client library are you using to connect to the Streaming API? are you able to share any example code so I can see whether I can reproduce?


#4

I am using Apache Client Library.

I think you can reproduce the case by filtering for Hashtag that is not known, i used #Telephoenic.
Nothing special about the Code I used the following for Reading the Stream:
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));


#5

I suspect this is due to you using a BufferedReader object in Java? are there any configuration options you could play with on that?

(edit: just checked - can’t see any method to tweak on BufferedReader. This is the point of a BufferedReader, though - batch up input to be more efficient)


#6

What do you suggest? I used Inputstream object it worked but each tweet was received in two chunks.
is there an solution that i can receive each Tweet as one piece?

Thank you


#7

I’d need to have a play with this technically to think about how best to approach the issue. In the meantime - have you looked at the hosebird client (hbc) project from @TwitterOSS? that’s built to be a streaming API consumer in Java. Might give you some ideas?