Tweet Stream library
in
Library and Tool Development
•
3 years ago
Tweet Stream is an amazing library for making processing work with twitter.
starting from the given example the library is easy to adapt
- TweetStream s = new TweetStream(this, "stream.twitter.com", 80, "1/statuses/filter.json?follow=12", "user", "pwd");
a list of search parameters on twitter you can find here:
so coming to my question:
If there are no new messages for a while there is a SocketTimeoutException. and after that the library is waiting for some time to reconnect (sleeping time).
- couldn't connect to http://stream.twitter.com:80/1/statuses/filter.json?follow=12: java.net.SocketTimeoutException: Read timed out
- reconnect failed. sleeping for 1000 ms before attempting next reconnect
1000ms would be no problem, but if there's no new tweet coming in for some time the sleeping time automatically adds up to a long time to reconnect.
well what i want to achieve is that my app checks twitter continuously (at least something like every 2 seconds on a regular base). i think i have to control either the socketTimeoutMs so it stays connected longer or i should get control of the increasing sleeping time.
i tried
- s.socketTimeoutMs = 200000;
throws an error
- The field TweetStream.socketTimeOutMs is not visible
any suggestions?
2