HI folks, what is the difference of `Channel.offer...
# coroutines
s
HI folks, what is the difference of
Channel.offer
and
Channel.send
, I know that send suspend and offer don't, but what is the usage difference?
s
With
send
, the receiver(s) will always get the sent value. With
offer
, the receiver(s) may not get offered value, it could be dropped if the buffer is full.
g
you can use offer from non-suspend function, which is very useful when you write adapters for coroutines from non-coroutine code. Also send is a way to achieve backpressure, slowdown senders if consumer is slower