refCount

fun <T> ConnectableObservable<T>.refCount(subscriberCount: Int = 1): Observable<T>

Returns an Observable that connects to this ConnectableObservable when the number of active subscribers reaches subscriberCount and disconnects when all subscribers have unsubscribed.

Please refer to the corresponding RxJava document.