https://kotlinlang.org logo
#coroutines
Title
# coroutines
e

enleur

03/12/2018, 6:01 PM
@spierce7 have you tried
ConflatedBroadcastChannel
for broadcasting?
s

spierce7

03/12/2018, 6:51 PM
My understanding was that
ConflatedBroadcastChannel
is similar to an
AsyncSubject
. What if I wanted something similar to a
PublishSubject
?
e

enleur

03/12/2018, 7:44 PM
Not sure what
PublishSubject
actually does, but in
ConflatedBroadcastChannel
when you publish messages and there are no subscribers, these messages will be lost. Subscribers will get only messages that were posted after their subscription
s

spierce7

03/12/2018, 8:46 PM
Oh? That sounds like a
PublishSubject
then.
e

enleur

03/12/2018, 8:52 PM
Just give it a try 🙂
d

dave08

03/12/2018, 9:33 PM
PublishSubject
==
BroadcastChannel(0)
,
BehaviorSubject
==
ConflatedBroadcastChannel
(which has a buffer of one, which is the latest value of the channel, but there's an open pull request to make this even better...)
👍 2
As far as I remember of Rx, since I dumped it for a while now because of coroutines...
s

spierce7

03/12/2018, 10:20 PM
oh? Maybe I'm misunderstanding the way channels work then.
d

dave08

03/13/2018, 3:14 AM
The pull request is here https://github.com/Kotlin/kotlinx.coroutines/pull/274 , this pull is becoming more like a BehaviorRelay
4 Views