Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SignalR vs. Reactive Extensions

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

like image 770
Mike Flynn Avatar asked Dec 07 '11 19:12

Mike Flynn


People also ask

What is the purpose of reactive extension?

ReactiveX (also known as Reactive Extensions) is a software library originally created by Microsoft that allows imperative programming languages to operate on sequences of data regardless of whether the data is synchronous or asynchronous.

What is reactive Programming C#?

In reactive programming, correlating events means correlating multiple observable messages into a single message that is the result of two or more original messages.


1 Answers

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.

like image 98
Pavel Gatilov Avatar answered Sep 22 '22 14:09

Pavel Gatilov