Skip to content

Instantly share code, notes, and snippets.

@rohmanhakim
Created November 17, 2018 16:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rohmanhakim/5c2eda205b3f501ee9ebf5fe63ebf07a to your computer and use it in GitHub Desktop.
Save rohmanhakim/5c2eda205b3f501ee9ebf5fe63ebf07a to your computer and use it in GitHub Desktop.
val observable = Observable.just("some event")
.map {
Thread.sleep(randomInt())
System.currentTimeMillis()
}
.publish()
.autoConnect(2)
val sub1 = observable.subscribe({ println("sub1 got : $it") },{})
val sub2 = observable.subscribe({ println("sub2 got : $it") },{})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment