RxJS Observable: Emit when specific part of the object changes

Viewed 4421

I have a complex object having child objects and arrays and so on.

I can easily create a Subject/BehaviourSubject or Observable from this object so that I can "next" (emit) the new state to the subscribers.

[ex: let appEnv$ = new Rx.BehaviorSubject<IWebSocketAppEnv>(appEnv);]

However I don't want all my subscribers to be notified every time the object changes. For instance for one of my subscriber, I only want to be notified when a change occurs on an elements of an array of that object.

Actually what I want is something redux is already doing. In redux, I can subscribe to the store but selecting only a child element.

I want to implement the same infrastructure for my back-end websocket server application.

How can I achieve that with RxJS?

2 Answers
Related