-
Notifications
You must be signed in to change notification settings - Fork 90
Description
What is your stance on multicast vs. unicast for observables? Well known stream / observable implementations have varying opinions on this topic. RxJS is "unicast" by default [1] while Kefir [2] and Bacon [3] are multicast by default. From what I can tell based on the existing es-observable implementation, es-observable is aligned with RxJS and only provides a "unicast" option.
Note that the RxJS' multicast
operator does not result in the behavior of Kefir and Bacon. Kefir and Bacon retain automatic laziness and multicast enabled for all operators. The RxJS multicast
operator only lifts the previous operator in the observable chain to a multicast one. Successive operators remain unicast.
We found multicast to be extremely valuable during the development of our application. We used it to model expensive operations that are executed lazily. Result are shared between all subscribers.
export const severityDistribution = allReportedIssues.map(issues => {
// do expensive work here
return severityDistribution;
});
[1] http://jsbin.com/cidaheqoqa/edit?html,js,console
[2] http://jsbin.com/wuqarebegi/edit?html,js,console
[3] http://jsbin.com/maciradiya/edit?html,js,console