Hi Zhe Chen, It is possible for the streaming connection to restart or disconnect you. There are a few reasons why this can happen and all are explained in our Streaming API concepts document. Approaches on how to deal with disconnects are also explained in the document.
You can find the concepts document here: http://dev.twitter.com/pages/streaming_api_concepts with the specific information about connecting here: http://dev.twitter.com/pages/streaming_api_concepts#connecting Let us know if you have any questions, Best, @themattharris Developer Advocate, Twitter http://twitter.com/themattharris On Tue, Feb 15, 2011 at 10:25 AM, Zhe Chen <chenzhe....@gmail.com> wrote: > I will get an error says connection timed out after running my program > for many hours. > > What should I do to avoid this? > > my $listener = AnyEvent::Twitter::Stream->new( > consumer_key => $consumer_key, > consumer_secret => $consumer_secret, > token => $token, > token_secret => $token_secret, > method => "filter", > track => $searchTerm, > > on_connect => sub { > warn "bgStreamSearch.pl connected"; > }, > > on_tweet => sub { > my $tweet = shift; > writeTweet($tweet); > }, > > on_error => sub { > my $error = shift; > warn "ERROR: $error"; > $done->send; > }, > ); > $done->recv; > > -- > Twitter developer documentation and resources: http://dev.twitter.com/doc > API updates via Twitter: http://twitter.com/twitterapi > Issues/Enhancements Tracker: > http://code.google.com/p/twitter-api/issues/list > Change your membership to this group: > http://groups.google.com/group/twitter-development-talk > -- Twitter developer documentation and resources: http://dev.twitter.com/doc API updates via Twitter: http://twitter.com/twitterapi Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list Change your membership to this group: http://groups.google.com/group/twitter-development-talk