You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's the difference: Stream 2 received values twice which is wrong I believe.
This works properly if Source completes.
I believe the difference is that Combine doesn't recreate a Subject in case there are no subscribers left but Source is not completed.
Though RxJava uses new Subject in this case.
I suggest to clean data inside Subject when there are no subscribers left to be consistent.
The text was updated successfully, but these errors were encountered:
Yes, that's because RxJava and other implementations use referenceCounted() instead of autoconnect() in their share(replay:) implementations.
With a referenceCounted() operator there is no need for additional logic in ReplaySubject and therefore any subject that wants to provide this kind of functionality is able to.
I was unsure whether or not Combine had a method of recreating the behaviour of the refCount() operator and after further investigation it appears it does not.
So, in the meantime I've added a new referenceCounted() operator specifically for Multicast publishers. (Ideally it would work for all ConnectablePublishers but the protocol doesn't provide the necessary API for the task.)
Hello again!
Please consider the following code in RxJava:
It outputs:
Now let's check how Combine+Entwine works:
It outputs:
Here's the difference: Stream 2 received values twice which is wrong I believe.
This works properly if Source completes.
I believe the difference is that Combine doesn't recreate a Subject in case there are no subscribers left but Source is not completed.
Though RxJava uses new Subject in this case.
I suggest to clean data inside Subject when there are no subscribers left to be consistent.
The text was updated successfully, but these errors were encountered: