ios – Add media like video and picture with Websocket in swift


I’m making an attempt to add and obtain picture and video media utilizing WebSocket. Picture and video are in base64 string format. I get an error whereas receiving the string from the server via socket “Area=kNWErrorDomainPOSIX Code=40 “Message too lengthy” UserInfo={NSDescription=Message too lengthy}“.

//MARK: Obtain

func receiveMessage(){

 let workItem = DispatchWorkItem{ [weak self] in

  self?.webSocket?.obtain(completionHandler: { lead to
        
        swap consequence {
        case .success(let message):
            
            swap message {
            
            case .information(let information):
              //print("information")

            case .string(let strMessgae):
              //print("strMessgae")

       default:
                break
            }
        
        case .failure(let error):
            print("Error Receiving (error)")
        }
      }
    }

Getting error in case .failure. Please assist me out with the error and how you can resolve it.

Thanks prematurely.

Similar Posts

Leave a Reply

Your email address will not be published.