Skip to content

Instantly share code, notes, and snippets.

@JosiasSena
Last active November 14, 2019 17:30
Show Gist options
  • Save JosiasSena/8aeed6bc4b4f433f6b40daf7f6a822f9 to your computer and use it in GitHub Desktop.
Save JosiasSena/8aeed6bc4b4f433f6b40daf7f6a822f9 to your computer and use it in GitHub Desktop.
class SomePresenterOrViewModelEtc(private val api: GraphQLApi) {
// ...
fun sunscribeToMessages() {
val messagesSubscription = OnNewMessagesReceivedSubscription.builder()
.groupUUID("uuid")
.build()
api.subscribe(messagesSubscription)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe({
// handle results, like adding the result into a list
}, {
// handle errors
}).addTo(compositeDisposable)
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment