Hi,
Please check the code example here:
ConnectableObservable<Long> connectable = Observable.interval(200, TimeUnit.MILLISECONDS).publish();
Subscription s = connectable.connect();
connectable.subscribe(i -> System.out.println(i));
Thread.sleep(1000);
System.out.println("Closing connection");
s.unsubscribe();
Thread.sleep(1000);
System.out.println("Reconnecting");
s = connectable.connect();
The actual output is:
0
1
2
3
4
Closing connection
Reconnecting
Notice no more values appear after Reconnecting. Looks like calling unsubscribe on the ConnectableObservable's subscription also terminates subsequent subscriptions, too. I need to call connectable.subscribe(i -> System.out.println(i)) again in order to produce output while the text says that 'old observers will begin receiving values again' after calling connect() on the ConnectableObservable object. I'm using RxJava 1.0.14.
Reactions are currently unavailable
Hi,
Please check the code example here:
The actual output is:
Notice no more values appear after Reconnecting. Looks like calling unsubscribe on the ConnectableObservable's subscription also terminates subsequent subscriptions, too. I need to call connectable.subscribe(i -> System.out.println(i)) again in order to produce output while the text says that 'old observers will begin receiving values again' after calling connect() on the ConnectableObservable object. I'm using RxJava 1.0.14.