How to get all historical data from a PublishSubject
?
val ob = PublishSubject[Int]()
ob.subscribe(x => println("a: " + x))
ob.onNext(1)
ob.subscribe(x => println("b: " + x))
ob.onNext(2)
It prints:
a: 1
a: 2
b: 2
You can see there is no b: 1
printed.
If I have to use PublishSubject
(since I need to update an observable from multi places), how can I make sure later subscribers can also get the all historical data?