emqx / CocoaMQTT

MQTT 5.0 client library for iOS and macOS written in Swift
https://www.emqx.com/en
Other
1.57k stars 411 forks source link

Connection issue #584

Open sreekandukuri opened 3 months ago

sreekandukuri commented 3 months ago

We are encountering the following issue when attempting to connect with the code below.

CocoaMQTT(debug): socket disconnected mqttDidDisconnect: Optional(Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo={NSLocalizedDescription=Connection refused, NSLocalizedFailureReason=Error in connect() function})

    let clientID = "XXX"
    mqtt = CocoaMQTT(clientID: clientID, host: "XXX", port: 1883)
    mqtt.username = "XXX"
    mqtt.password = "XXX"
    //mqtt.willMessage = CocoaMQTTWill(topic: "/will", message: "dieout")
    mqtt.keepAlive = 60
    mqtt.delegate = self
    mqtt.logLevel = .debug
    mqtt.autoReconnect = false
    mqtt.connect()

    Thanks in advance