This project has moved and is read-only. For the latest updates, please go here.

Streaming API Stop getting tweets

Apr 15, 2014 at 9:28 AM

I upgrated LinqToTwitter API from v 2.x to 3.0.2 and then my twitter application sometimes stop receiving tweets.

In my application's log file, there are repeating empty twitter responses.

I couldn't figure out the problem.

I think it might be related to limits of twitter but in LinqToTwitter 3.0.2 "StreamContent" object does not have a "Status" property, because of that i cannot implement a backoff strategy.

I start two streams at the same time, my working code is like below,
(from strm in _twitterCtx.Streaming
             where strm.Type == StreamingType.User
             select strm)
              .StartAsync(async strm => StreamingCallback(strm));
 (from strm in _twitterCtx.Streaming
                    strm.Type == StreamingType.Filter &&
                    strm.Track == track
                 select strm)
              .StartAsync(async strm => StreamingCallback(strm));
Thank you.
May 3, 2014 at 5:19 PM
Can anyone offer me a reconnect strategy with LinqToTwitter 3.0.2 version ?

Thanks a lot.
May 3, 2014 at 9:25 PM

Add some logic in your callback to capture the strm instance. When you encounter and exception, need to stop, or need to restart; call strm.CloseStream(). Then create a new instance of TwitterContext and start a new stream.

May 5, 2014 at 6:45 AM
I have tried it before asking but it did not work last week. Somehow it started working last weekend.

This problem solved for me now.

By the way I started getting missing JSON strings as stream content after updating to version 3.0.2 like below example,


do you have any solution offer for this situation ?
I could not found any solution for that situation in the forum posts.

Thank you very much for your help.
May 5, 2014 at 2:13 PM
I've seen the stream do that before. A previous callback might have had the beginning of the tweet, truncated the first part, possibly sent numerous blank keep-alive messages, and then sent what you see there.

Does turning off compression help? You can set the IAuthorizer.SupportsCompression property to false.

May 13, 2014 at 10:58 AM
I have the same problem in Filter Streaming async with 3.0.2. But the problem is I don't find SupportsCompression property in SingleUserAuthorizer object.

May 13, 2014 at 1:06 PM
I compiled the source code in codeplex and SupportsCompression is available. The problem is that the issue that ismcagdas describe can't be fixed with SupportsCompression=false. A relevant % of tweets are delivered truncated.

May 19, 2014 at 6:48 AM
IAuthorizer does not have a property called SupportsCompression.
Jun 5, 2014 at 3:15 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jun 5, 2014 at 3:17 PM

I saw the occasional tweet truncation problem happening this weekend and created a new work item for it.

Jul 31, 2014 at 6:12 AM
Anyone solve this problem?
Jul 31, 2014 at 6:33 AM

This should be fixed in the latest version on LINQ to Twitter, v3.0.4.