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

dave08

12/06/2017, 5:29 PM
Is the statement in the reactive guide:
Note, that we can replicate the same behaviour that we saw with channels by using Rx publish operator and connect method with it.
really true? In Rx,
publish
makes a
ConnectableObservable
which I would think is the equivalent of a
BroadcastChannel
? Also is there a simple way of making a
produce { }
for a
BroadcastChannel
?
e

elizarov

12/06/2017, 6:57 PM
produce { ... }
for broadcast channel is not yet there. The plan is two fold: have
.broadcast()
extension for regular channels and have some one-stop-shop for
produce { ... }.broadcast()
. Naming is tough though.
produceBroadcast
? Meh…
d

dave08

12/06/2017, 7:11 PM
Why not simply
broadcast
?
e

elizarov

12/06/2017, 7:16 PM
maybe simply
broadcast
But should it be hot of cold (in Rx terms)?
d

dave08

12/06/2017, 7:54 PM
It's also the question by
produce
that's hot..., I know that my use case would be in Android MVP to replace Rx for UI components, the presenter should be able to subscribe to the flow of events from many places in the logic... so hot is great In the reactive lib. you provide
publish
for cold... whatever the cold
broadcast
would be, it would have to correspond with that, and also be a Publisher type? This was part of the original question.. what is called
publish
is really a cold version of
produce
and the hot
broadcast
is the real equivalent of rx's
publish
....
e

elizarov

12/06/2017, 8:25 PM
I see. That makes sense
Somehow in my mind I was associating
publish
with cold
broadcast
, but I see what you mean when you say that it is actually a cold version of
produce
d

dave08

12/07/2017, 10:55 AM
Is this feature going to be released soon (or at least with some code to 'steal' from the repo)? Should I open an issue on Github to track it (things tend to get lost on slack...)? I think there might be three things here, 1) Adding
broadcast
as hot, 2) Clarifying reactive docs that
publish
is not a broadcaster but rather like cold
produce
, 3) Adding a cold
broadcast
as a
Publisher
An extra might be to add an example in the UI guide for using
broadcast
for ui events to an MVP presenter or the like...? Like you have with actor...
4 Views