Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
class LiveStreamViewModel() : ViewModel() {
private val chatClient = ChatClient.instance()
private val _viewState = MutableLiveData<State>()
private lateinit var channelController: ChannelController
val viewState: LiveData<State> = _viewState
init {
chatClient.setUser(chatUser, USER_TOKEN, object : InitConnectionListener() {
override fun onSuccess(data: ConnectionData) {
channelController = chatClient.channel(CHANNEL_TYPE, CHANNEL_ID)
requestChannel()
subscribeToNewMessageEvent()
}
override fun onError(error: ChatError) {
_viewState.postValue(State.Error("User setting error"))
Timber.e(error)
}
})
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.