RxJS In-Depth – Ben Lesh
Why Stack Overflow recommends it
Stack Overflow users link it when answering questions about RxJS and Angular 2 observables, as a background explanation of how observables differ from promises.
Recommended by 5 people across 5 different months, 2015 to 2018.
What it is
A 30-minute conference talk from AngularConnect 2015 in which Ben Lesh, an RxJS maintainer, explains how RxJS works in depth. It covers observables, operators and the reactive programming model that Angular 2 adopted for async handling.
What people said
Recommends gilamran · 2015-11 · Stack Overflow · on “Implementing UDP Command-Acknowledge communication protocol in Node.JS and TypeScript”
Using q here will not serve you well, this is why: q is intended for helping your library users use your library in an async way. Is it intended more as a "nice" way to let your users know when something is done. and then do something else that they want to do (In their code). But when building a protocol, you don't want to do .then everywhere, especially if you don't know what's coming next. What to use? I trully recommend rxjs here, it's using observables and it'll be much more intuitive to implement each command. It will also be very easy to create a queue out of all your commands and run over all of them in a (async) loop way. You can watch few minutes about it here [this video] . (Don't worr
Recommends Thierry Templier · 2016-01 · Stack Overflow · on “Angular2 http.get() ,map(), subscribe() and observable pattern - basic understanding”
Concepts Observables in short tackles asynchronous processing and events. Comparing to promises this could be described as observables = promises + events. What is great with observables is that they are lazy, they can be canceled and you can apply some operators in them (like map , ...). This allows to handle asynchronous things in a very flexible way. A great sample describing the best the power of observables is the way to connect a filter input to a corresponding filtered list. When the user enters characters, the list is refreshed. Observables handle corresponding AJAX requests and cancel previous in-progress requests if another one is triggered by new value in the input. Here is the co
Recommends Fougere · 2016-03 · Stack Overflow · on “Angular promise multiple times”
RxJS Observable has replaced promise in angular2 this is why you find a lot of ressources on it related to angular2. here [this video] is a youtube video of Ben Lesh that explain how it works. For the Object part I was thinking of a User Object `{name: 'fougere', ...}` which stores your user informations with a function getUserAds which simply get the data form the storage (cache/database/whatever).
Recommends KwintenP · 2016-11 · Stack Overflow · on “Buffering multiple subscribers to rx.js observable”
First of all, the creation of the subject can be simplified like this: const subject = rx.Observable.fromEvent(blah, 'event') .filter(blah) .map(blah) .share(); The share method will create a Subject from the stream. If you return this subject instance to every subscriber, you'll get the same behaviour and it looks better. a) if the events come in super fast is the handler going to process them synchronously and in the right order given the way I have it? Events are going to be pushed through the entire chain one by one and in the correct order. Meaning, an event that comes in through the 'fromEvent' will be pushed through the entire chain until the point you are subscribed to it, before han
Recommends cartant · 2017-02 · Stack Overflow · on “Returning Inner Block Observable Object”
This seems to explain array reduce [LINK] well enough. For RxJS: RxJS In-Depth [this video] ; Intro to Reactive Programming [LINK] ; and Don’t Unsubscribe [LINK] .
Cites Eric Martinez · 2015-10 · Stack Overflow · on “Unable to figure out correct EventEmitter or Observable Syntax in Angular2 Services”
Actually it's almost the same thing, there a few changes createUser(user: any): any { return new Observable.create(observer => { this.ref.createUser(user, function(error, userData) { if (error) { observer.error(error); console.log("Error creating user:", error); } else { observer.next('success'); observer.complete(); console.log('Successfully created user account with uid:', userData.uid); } }); }) } And then you can suscribe to it ( subscribe is the equivalent of then ). Here's a plnkr [LINK] with an example using Observables constructor() { this.createUser({}).subscribe( (data) => console.log(data), // Handle if success (error) => console.log(error)); // Handle if error } EventEmitter on t
Cites gwest7 · 2017-10 · Stack Overflow · on “Angular 4 RxJs WebSocket”
The first post is making single-request-single-response calls via a socket. I would really suggest to the author to just use HTTP. Your notify requirement is a better application for WebSockets. I would suggest you multicast ( share() ) the observable and whoever needs receive data from the WebSocket subscribe. Here is an example with Angular components. @Injectable() export class ChatService { public messages: Subject<Message>; public shared: Observable<Message>; constructor(wsService: WebsocketService) { this.messages = <Subject<Message>>wsService .connect(CHAT_URL) .map((response: MessageEvent): Message => { let data = JSON.parse(response.data); return { author: data.author, message: data
Cites Jason Awbrey · 2018-02 · Stack Overflow · on “WordPress Rest API get All Posts”
One way to solve this is with RxJS [LINK] We'll build a small Observable stream that will: Output all post data Not force us to know total number of posts OR pages beforehand Not force to keep track of "where we're at" in the context of pagination Libraries we'll use: Axios [LINK] (To simplify the HTTP GET, as it works both in Node and Browser environments) RxJS v6 [LINK] (Currently an Alpha release, but the API here is the same for RxJS 5) Your environment and use case will vary, for this example I'm going to be in a Node environment. /** * This will get all posts from a default WordPress REST API * First we see how many pages there are * Then we make subsequent XHR requests (via Axios) * T