We're trying to observe either a 15s interval, or whenever we're firing onNext
on our subject refreshEventsSubject
, but without success.
The subject is initiated like so
private val refreshEventsSubject = PublishSubject<Long>()
And then we try to observe it like this
Observable.merge(Observable.interval(0, 15, TimeUnit.SECONDS), refreshEventsSubject)
.subscribe { ... }
We get the events from the interval every 15s, but the subject is not firing after running
refreshEventsSubject.onNext(0)
Any ideas appreciated.
(Everything is written in Kotlin)
Make sure refreshEventsSubject.onNext(0)
is not called from your main thread as it may cause deadlocks!
Also use http://reactivex.io/documentation/operators/amb.html rather than merge as merge will emmit two events oppon calling onNext on your subject.