Trying to join a dialog from the dialog instance locally saved in a Room Database Model. And it gives me this error. However, works fine when I fetch the dialog from server.
public QBChatDialog getDialogFromDialogModel(ChatDialogModel mChatDialogModel) {
QBChatDialog mQBChatDialog = new QBChatDialog();
mQBChatDialog.setRoomJid(mChatDialogModel.getRoomJid());
mQBChatDialog.setRoomJid(mChatDialogModel.getRoomJid());
mQBChatDialog.setDialogId(mChatDialogModel.getDialogId());
mQBChatDialog.setName(mChatDialogModel.getName());
List<Integer> occupants = new ArrayList<>();
String[] arrayoccu = mChatDialogModel.getOccupantsIds().split(",");
occupants.add(Integer.parseInt(arrayoccu[0]));
occupants.add(Integer.parseInt(arrayoccu[1]));
mQBChatDialog.setOccupantsIds(occupants);
mQBChatDialog.setLastMessage(mChatDialogModel.getLastMessage());
mQBChatDialog.setUnreadMessageCount(mChatDialogModel.getUnreadMessageCount());
mQBChatDialog.setUserId(mChatDialogModel.getUserId());
mQBChatDialog.setType(QBDialogType.GROUP);
mQBChatDialog.setLastMessageDateSent(mChatDialogModel.getLastMessageDateSent());
mQBChatDialog.setLastMessageUserId(mChatDialogModel.getLastMessageUserId());
return mQBChatDialog;
}
qbChatDialog = qbChatHelper.getDialogFromDialogModel(dialogModel);
DiscussionHistory discussionHistory = new DiscussionHistory();
discussionHistory.setMaxStanzas(0);
qbChatDialog.join(discussionHistory, dialogJoinedCallback);
I/QBChatDialog: join to QBChatDialog{id=5d93e886424a796de0b87be3, created_at=null, updated_at=null, last_msg_user_id=0, occupants_ids=[83435042, 83435082], last_message=null, last_message_date_sent=0, type=GROUP, name=5d93dad7424a796de0b87b8c, room_jid=75367_5d93e886424a796de0b87be3@muc.chatsmart.quickblox.com, user_id=83435042, photo=null, unread_message_count=0, customData=null} 2019-10-02 03:19:59.068 12608-12608/com.smartsco.recaruoperator I/ChatFragment: DIALOG JOIN - FAILED: Client is not, or no longer, connected. com.quickblox.core.exception.QBResponseException: Client is not, or no longer, connected.
Have to do this before joining the (locally retrieved) dialog...
qbChatDialog.initForChat(QBChatService.getInstance());