SignalR vs. Reactive Extensions
Asked Answered
L

1

46

Is SignalR the same thing is Reactive Extensions? Can you explain why or why not?

Lodi answered 7/12, 2011 at 19:58 Comment(1)
However, SignalR can help you publish serverside observables on the clientside github.com/cburgdorf/SignalR.ReactiveTruck
S
98

No, they are absolutely not the same thing.

Reactive Extensions is a library for creating and composing observable streams of data or events (which are actually quite similar). It basically knows nothing about client-server connections or other things. It is focused solely on Observables and is capable of wrapping any collection, stream, event, async method, etc. into the common Observable interface.

SignalR is a toolkit for creating persistent (i.e. alive) duplex connections between client and server. It works over HTTP and its purpose is wrapping 3 low-level techniques: long-polling, server-side events and web sockets into a high-level API for comfortable development. So, it's focused on the communication.

So, the components themselves are quite independent from each other, and they have completely different concerns.

On the other hand, these 2 great libraries are complementary to each other: one might use SignalR to push events from server to clients and then wrap the server-side events into RX's Observables to create complex reactive user experiences.

UPDATE

Rx is like LINQ, it helps you specify 'what happens', it doesn't get into the details of 'how'. SignalR is a library to implement the 'how' for real-time network communication – Paul Betts

The difference between 'LINQ to Objects' and RX is that in 'LINQ to Objects' you pull next items from an enumerable thing, while in RX they are pushed to you from an observable thing.

Sociable answered 7/12, 2011 at 20:56 Comment(7)
+1, Rx is like LINQ, it helps you specify 'what happens', it doesn't get into the details of 'how'. SignalR is a library to implement the 'how' for real-time network communicationCanada
@PaulBetts +1 Great comparison with LINQ, RX's twin-brother. I've added a quote to the answer.Sociable
FYI: Rx is built on top off LINQ. It just happens that until Rx came along, the main usage of LINQ was with the IEnumerable<T> interface. LINQ is the combined language features of Anon Types, Extension methods, Lambdas, Expression (trees) and Query Comprehension Syntax.Yurikoyursa
@LeeCampbell True. However, the LINQ term is frequently confused with its specific implementation living in System.Linq.Enumerable class, that is LINQ to Objects. I'll update the answer to use LINQ to Objects to avoid confusion.Sociable
Cool, I was just trying to stop that confusion and discourage the continuation of the misuse of the term (as far as I understand it)Yurikoyursa
wouldn´t Ix be the twin-brother of Rx ?Heteropolar
@marsop, not a twin perhaps. As I understand it, Ix extends LINQ, while Rx is a reactive dual side for the LINQ + Ix combo. But in the sense that Ix brings the LINQ capabilities up to equal Rx - they are very close.Sociable

© 2022 - 2024 — McMap. All rights reserved.