RxJava2 Blocking Observable Timeout: How do I emit a result when timeout fires?

Viewed 4166

I have an Observable that emits events in the form of JSON strings. I want to subscribe to it blocking and get the first string. Not a problem.

But I would like to also have a timeout and emit a canned JSON string when the timeout fires.

Here is my existing code:

String jsonString = rxEvents.subscribe().toBlocking().first();
1 Answers
Related