CocoaMQTT icon indicating copy to clipboard operation
CocoaMQTT copied to clipboard

Error Domain=NSPOSIXErrorDomain Code=57 "Socket is not connected

Open amitsanvedi opened this issue 5 years ago • 1 comments

Hi I am newer in MQTT and used your library and want to make connection with following server URL:Ws://trialadm.satalarm.com/mqtt I am using below code but getting error Response Error : mqttDidDisconnectOptional(Error Domain=NSPOSIXErrorDomain Code=57 "Socket is not connected" UserInfo={NSErrorFailingURLStringKey=http://trialadm.satalarm.com:8000/mqtt, NSErrorFailingURLKey=http://trialadm.satalarm.com:8000/mqtt})

Code : let clientID = "CocoaMQTT-" + String(ProcessInfo().processIdentifier) let websocket = CocoaMQTTWebSocket(uri: "/mqtt") let mqtt = CocoaMQTT(clientID: clientID, host: "trialadm.satalarm.com", port:8000, socket: websocket) mqtt.username = "nit" mqtt.password = "VR4xZCwPoBVAoxaHCI1R" mqtt.keepAlive = 60 mqtt.delegate = self // mqtt.allowUntrustCACertificate = true //mqtt.enableSSL = false mqtt.willMessage = CocoaMQTTMessage(topic: "testtopic/1212", string: "Testing rg") mqtt.willMessage?.retained = true let connect = mqtt.connect()

There are 2 things first I am not able to connect and second thing the url which is showing in response is having http url as it should Ws url. Please let me know whats wrong with this.

amitsanvedi avatar Apr 25 '20 14:04 amitsanvedi

Same Problem

Raonshi avatar Dec 04 '23 08:12 Raonshi