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

Running user streaming

May 22, 2014 at 1:42 AM
Edited May 22, 2014 at 1:43 AM
I'm trying to setup streaming in a Windows Phone Runtime app, as so -
private async void StreamTimeline() {
    var twitterCtx = GetTwitterContext();

     (from strm in twitterCtx.Streaming
             where strm.Type == StreamingType.User
             select strm)
            .StartAsync(async strm =>
                    string mse = strm.Content;
I'm having to call it using Task so I don't block the UI thread -
Task.Run(new Action(StreamTimeline));
My issue is that I normally only receive at most two responses (one with a list of friends IDs and another empty).

What is the appropriate way to have this setup continuously query the stream?
May 22, 2014 at 3:34 AM

Have you upgraded to the latest version of LINQ to Twitter v3.0.3? I added some code that should help with some of these problems.

May 22, 2014 at 11:19 AM
Edited May 22, 2014 at 2:19 PM
Just updated now but still getting the same issue, most of the time not even receiving the initial list of friends IDs.

Any idea how I can go about debugging this issue?
May 22, 2014 at 2:44 PM
Further clarification - I'm not receiving any statuses via the StreamingType.Sample or StreamingType.Filter (track -- ""twitter").

However if I leave it active for a period I eventually get "Twitter has closed stream" exception.
May 22, 2014 at 3:30 PM
Are you calling Dispatcher.BeginInvoke in the callback? I have a demo, Linq2TwitterDemos_WindowsPhone in the downloadable source you can try out too.
May 22, 2014 at 3:56 PM
Edited May 23, 2014 at 3:37 PM
Yes I'm calling Dispather.BeginInvoke() to update the UI thread. Could this be the reason?

I'll take a closer look at the demos, thanks

(Having removed Dispather.BeginInvoke() the issue is still persisting).

Demo seems to work fine so I'm wondering if it could be some incompatibility with WP8.1?
Jun 2, 2014 at 3:33 AM
This looks like an issue that shows up on WP 8.1. I tried the same code with 8.0 and 8.1 and the 8.0 version works. I'm seeing an internal issue where it seems to deadlock on ReadLineAsync and ReadLine in WP 8.1.