IQbservable in Linq2Twitter

Dec 4, 2012 at 4:56 PM

Hi! First of all, Linq2Twitter is by far the best .NET Twitter API! Thanks for making it available to the public.

Now, to the topic in question. I've just begun using Microsoft Rx (Reactive Extensions) in conjunction with Microsoft StreamInsight, and I think both frameworks are awesome.

IQbservable (not IObservable, this is a new interface provided by Microsoft Rx), it's basically the opposite of IQueryable (in the sense that IQueryable is a pull based interface, and IQbservable is a push based interface).

Just take this query for example:


var myQuery = from strm in context.Streaming
             where strm.Type == StreamingType.Filter && strm.Track == "Microsoft"
             select strm.Content;

var monitorTwitter = myQuery.Subscribe(
content => {
Console.WriteLine("Twitter response: {0}", content);


It's quite similar to the way the current Linq2Twitter API works, but with some obvious added benefits.

Still, this is just a suggestion.




Dec 4, 2012 at 10:35 PM

That's interesting - thanks for the input.


Oct 21, 2014 at 12:47 AM
+2 from me.

First, while the LINQ-based streaming API works, it's not intuitive because it was designed for queries. I remember starting out two years ago thinking, "this can't be right, what's this "FirstOrDefault" for?" And even though it worked, I never fully trusted it because it seemed so arbitrary. (To be honest, I'm just now understanding it). Whereas the IQbservable was designed for streams, and as you can see in the sample above, it's far more intuitive to new users, and essentially no learning curve for anyone who uses Rx regularly.

Second, it lets you integrate seamlessly into the vast network of combinators and libraries built for Rx. Here's just the built-in combinators. I'm sure you can see the benefit there. I think this would be a huge improvement to your streaming API.
Oct 21, 2014 at 5:35 AM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Oct 21, 2014 at 5:39 AM

I totally agree. Now that I have async and Xamarin support going in the right direction, there are 3 things I want to do: Windows Phone 8.1, Stream Parser, and RX. As you can see, I've added this as a new issue.