Filtered Stream Hangs

Dec 29, 2014 at 4:37 PM
My application is hanging when I try to use the filteredStream.

Here is my code:
        //ValueThatLtd tests
        TwitterCredentials.SetCredentials("my various keys",,,);

        // Access the filtered stream
        var filteredStream = Stream.CreateFilteredStream();
        filteredStream.MatchingTweetReceived += (sender, args) => { Console.WriteLine(args.Tweet.Text); };

And then it hangs. I am using version of Tweetinvi within MVC project (from template) in Visual Studio 2013. I call the above code from a controller.

Any suggestions as to what might be wrong?

Best regards
Jan 5, 2015 at 9:55 AM
Try await filteredStream.StartStreamMatchingAllConditionAsync(); instead.
Apr 16, 2015 at 10:15 PM
Thank you thoze,
I had the same problem as WildAl but after using "StartStreamMatchingAllConditionAsync" function as you suggested, I am now able to get the tweets, however the application is freezing and I can't click on any other button such as "Stop Stream".

I tried to use "DoEvents" method but to no avail.
Also I coudn't use the keyword "await" since it is not available in Visual Studio 2010 which I have.

Any other suggestions?

By the way I use code:
    Sub Stream_FilteredStream()
        filteredStream = Stream.CreateFilteredStream()
        AddHandler filteredStream.MatchingTweetReceived, AddressOf MatchedTweetReceivedEvent
    End Sub
    Sub MatchedTweetReceivedEvent(sender As Object, e As Tweetinvi.Core.Events.EventArguments.MatchedTweetReceivedEventArgs)
    End Sub
Apr 19, 2015 at 2:22 AM

You can either use the async method as suggested or create a Thread/BackgroundTask that you "listen" in your main (UI) thread in order to update your UI.
Your issue is a Thread issue not a Tweetinvi issue.