Search code examples
iosobjective-cswiftsendbird

Automatic reconnection of sendbird sdk


I am getting error description after 5 mins.that's because of auto reconnection of sendbird sdk. so, is it any way to stop auto-connection or decrease the error message arrival time.

Here is what i have tried,

 let preSendMessage = channel.sendFileMessage(withBinaryData: data!, filename: "demo", type: mimeType! as String, size: UInt((data?.count)!), thumbnailSizes: [thumbnailSize!], data: "", customType: "", progressHandler: nil, completionHandler: { (fileMessage, error) in
                            DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + .milliseconds(150), execute: {

                                let preSendMessage = self.preSendMessages[(fileMessage?.requestId)!]
                                self.preSendMessages.removeValue(forKey: (fileMessage?.requestId)!)

                                if error != nil {
                                    self.resendableMessages[(fileMessage?.requestId)!] = preSendMessage
                                    self.resendableFileData[(preSendMessage as! SBDFileMessage).requestId!] = [
                                        "data": data as AnyObject,
                                        "type": mimeType as AnyObject,
                                    ]

                                    self.chatTableView.reloadData()
                                    DispatchQueue.main.async {
                                        self.chatTableView.scrollToLastRow(animated: true)
                                    }

                                    return
                                }

                                if fileMessage != nil {
                                    self.resendableMessages.removeValue(forKey: (fileMessage?.requestId)!)
                                    self.resendableFileData.removeValue(forKey: (fileMessage?.requestId)!)

                                    self.messages[self.messages.index(of: preSendMessage as! SBDFileMessage)!] = fileMessage!

                                    DispatchQueue.main.async {
                                        self.chatTableView.reloadData()
                                        DispatchQueue.main.async {
                                            self.chatTableView.scrollToLastRow(animated: true)
                                        }
                                    }
                                }
                            })
                        })

Solution

  • Finally got the solution,

    Error shown because sendbird don't allow to send file message that contain size of 15MB or more.

    so, i resized the video size then sent to sendbird server now it's working.