Quantcast
Channel: Tweetinvi a friendly Twitter C# library
Viewing all articles
Browse latest Browse all 4126

New Post: Best practice for keeping streams alive

$
0
0
private IFilteredStream _ts;

privatevoid StartStream()
{
    _ts = Stream.CreateFilteredStream();

    _ts.StreamStopped +=
        (sender, args) =>
        {
            Thread.Sleep(2000);
            _ts.StartStreamMatchingAnyCondition();
        };

    _ts.AddFollow(_twitterMonitorUser, processTweet);
    _ts.StartStreamMatchingAnyCondition();
}
This is how I do it. However, you may want to follow twitter's guidelines for the wait time. Two seconds works well in my case.

Viewing all articles
Browse latest Browse all 4126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>