I'm trying to use quickblox for a chat but I getting the fallowing error: com.quickblox.core.exception.QBResponseException: Client is not, or no longer, connected in join QBResponseException
fun CreateDialog(){
val occupantIdsList = ArrayList<Int>()
occupantIdsList.add(128780267)
val dialog = QBChatDialog()
dialog.type = QBDialogType.PRIVATE
dialog.setOccupantsIds(occupantIdsList)
QBRestChatService.createChatDialog(dialog).performAsync(object :
QBEntityCallback<QBChatDialog> {
override fun onSuccess(result: QBChatDialog?, params: Bundle?) {
Log.e(TAG, "result: $result")
result!!.lastMessage = "hey"
JoinDialog(result!!)
}
override fun onError(responseException: QBResponseException?) {
Log.e(TAG, "${responseException}")
}
})
}
fun JoinDialog(dialog: QBChatDialog){
Log.e(TAG, "Joinnnn: $dialog")
val history = DiscussionHistory()
history.maxStanzas = 0
dialog.join(history, object : QBEntityCallback<Void> {
override fun onSuccess(o: Void?, bundle: Bundle?) {
SetConnection()
SendMessage(dialog)
Log.e(TAG, "Join Good")
}
override fun onError(e: QBResponseException?) {
Log.e(TAG, "Join Error: $e")
}
})
}
Just before joining the dialog can you please try the following
I think the client is not connected because of the connection being lost. So you can give it a try by initializing just before joining the dialog.