What is the difference between a publish and multicast statement in rxjs 5?

I am reading the rxjs manual, I am a bit confused about the difference between multicast and publish operators. They seem very similar.

+5
source share
2 answers

I had the same question while reading http://reactivex.io/rxjs/manual/overview.html . So, to make this clear, .publish() is just a shorthand for .multicast(new Rx.Subject()) (and publishBehavior , publishLast and publishReplay are similar, but create an instance of BehaviorSubject , AsyncSubject and ReplaySubject respectively).

+11
source

They are really very similar, and they have a story that makes it even more confusing.

Simply put, publishing is a special case of multicast. publication always creates a new object (and then uses multicast to a large extent), while multicast uses the object provided as an argument.

+3
source

All Articles