Beginning RxKotlin 路 Schedulers and Timing Operators | raywenderlich.com


This is a companion discussion topic for the original entry at https://www.raywenderlich.com/7419-beginning-rxkotlin/lessons/20

Hi Macsimus,

As you mentioned in the tutorial. Observable and operators works on main thread by default. But as per my understanding Rx perform all its operation on computation thread by default. Only the subscription happens on the main thread. Please check the below thread and let me know If I am wrong.

@macsimus Can you please help with this when you get a chance? Thank you - much appreciated! :]

Thanks for the question, Sagar. By default, the Observable and operators run on the same thread that you subscribe on. Certain operators default instead to the computation scheduler. These are:

Static: interval(), timer(), timeout()
Instance: buffer(), delay(), take(), skip(), takeWhile(), skipWhile(), timeout() and window().

So the SO post you referenced is defaulting to the computation scheduler because is uses interval().