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

Alexjok

06/25/2019, 12:35 PM
I have a stream and I want subscribe to it several listeners. How can I do it in Kotlin?
m

marstran

06/25/2019, 12:38 PM
What kind of stream? Which API are you using?
a

Alexjok

06/25/2019, 12:47 PM
kotlin channels
m

marstran

06/25/2019, 12:47 PM
Do you want every listener to get every message?
a

Alexjok

06/25/2019, 12:48 PM
yes
m

marstran

06/25/2019, 12:48 PM
If so, then you need a
BroadcastChannel
The sender sends to the
BroadcastChannel
, while the listeners receives messages from a
ReceiveChannel
returned from
broadcastChannel.openSubscription()
.
👍 1
a

Alexjok

06/25/2019, 12:52 PM
yeah, that's what i find. Thx 🙂
m

marstran

06/25/2019, 12:53 PM
No problem