I am making one iOS app communicating with Mqtt broker, mainly to publish message. But when I try to connect with broker using CocoaMQTT library it's always giving me error in connection.
I am trying with CocoaMQTT latest version and also 1.1.3 version. But both are failing in connection and giving me error
(Error Domain=kCFStreamErrorDomainNetDB Code=8 "nodename nor servname provided, or not known" UserInfo={NSLocalizedDescription=nodename nor servname provided, or not known})
formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSS"
let dateString = formatter.string(from: date)
let clientID = "smart-curtain-"+dateString
mqttClient = CocoaMQTT.init(clientID: clientID, host:
contantData.MQTT_BROKER_URL, port: UInt16(1883))
mqttClient.username = nil
mqttClient.password = nil
mqttClient.autoReconnect = true
mqttClient.allowUntrustCACertificate = true
mqttClient.keepAlive = 60
mqttClient.enableSSL = false
So its always ending up withmqttDidDisconnect delegate method. My broker url is tcp://xyz.com (xyz is just example) and port is 1883. I have tried 2-3 Mqtt toll apps from my iPhone to connect with broker detail, but no one able to connect it.
But same settings working fine in Android app. (it is using net.igenius:mqttservice:1.6.4) (this broker is no need authentication)