10/19/2020, 9:21 PM
Hey, I'm trying to write an extension method that uses .replay internally. My problem is that if I don't follow .replay with autoConnect/refCount etc, and move on to other operators, then I lose the ConnectableObservable reference. I would like to not include refCount as part of the method impl, and return ConnectableObservable to let consumers decide. Is there a way to achieve this?
fun <T> Observable<T>.foo(): ConnectableObservable<T> {
  return someOperators...
I could add a parameter
connectionStrategy: (ConnectableObservable<T>) -> Observable<T>
and apply it right after the .replay, but that feels dirty