Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RxJS/Rx.Net Observable-subscribe vs events - Performance/Threads [closed]

I recently started working on Reactive Extensions, mostly observables at client side using Angular 2. The concept of observables of Rx and events of dotnet seems to be very similar. Are there any specific examples where one is applicable and other is not. If not, is there any other reason why Microsoft introduced Rx.Net, as observables stand at the core of Reactive Extensions. Any links or real time examples would suffice. Has it got something better to do with respect to async/await, tasks or threads? I am looking for differences threading/performance wise.

like image 837
Sreenath Avatar asked Jul 15 '17 06:07

Sreenath


1 Answers

They are different abstractions. Everything in this answer applies equally to JavaScript and C#.

async/await allow you to asynchronously wait for a single asynchronous operation. This "asynchronous operation" can only complete one time, with a single result.

Observables allow you to subscribe to a stream of data, and react to data arriving on that stream. This subscription model allows multiple items of data over time.

like image 68
Stephen Cleary Avatar answered Nov 04 '22 19:11

Stephen Cleary