I have a stream and I want subscribe to it several...
# coroutines
a
I have a stream and I want subscribe to it several listeners. How can I do it in Kotlin?
m
What kind of stream? Which API are you using?
a
kotlin channels
m
Do you want every listener to get every message?
a
yes
m
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
yeah, that's what i find. Thx 🙂
m
No problem