加入错误:com.quickblox.core.exception.QBResponseException:客户端未连接或不再连接

问题描述

我正在尝试使用 quickblox 进行聊天,但出现以下错误: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")
            }
        })
    }

解决方法

就在加入对话之前,请您尝试以下操作

dialog.initForChat(QBChatService.getInstance());

我认为客户端没有连接,因为连接丢失。因此,您可以在加入对话框之前通过初始化来尝试一下。