Friday, May 24, 2024
HomeiOS Developmentios - MQTT shopper doesn't join, disconnects after receiving 0 knowledge from...

ios – MQTT shopper doesn’t join, disconnects after receiving 0 knowledge from dealer


Because the titles signifies my shopper is closing after receiving 0 knowledge from dealer. My dealer makes use of a Self Signed Certificates. Subsequent I’ll point out my code and logs.

`
func selfSignedSSLSetting() {
if mqttVesion == “3.1.1” {

        let clientID = "CocoaMQTT-(animal!)-"
        mqtt = CocoaMQTT(clientID: clientID, host: defaultHost, port: 1883)
        mqtt!.username = "xxx"
        mqtt!.password = "xxx"
        mqtt!.keepAlive = 60
        mqtt!.delegate = self
        mqtt!.allowUntrustCACertificate = true
        mqtt!.logLevel = .debug


    }else if mqttVesion == "5.0" {

        let clientID = "CocoaMQTT5-(animal!)-"
        mqtt5 = CocoaMQTT5(clientID: clientID, host: defaultHost, port: 1883)

        let connectProperties = MqttConnectProperties()
        connectProperties.topicAliasMaximum = 0
        connectProperties.sessionExpiryInterval = 0
        connectProperties.receiveMaximum = 100
        connectProperties.maximumPacketSize = 500

        mqtt5!.connectProperties = connectProperties
        mqtt5!.logLevel = .debug

        mqtt5!.username = "xxx"
        mqtt5!.password = "xxx"
        mqtt5!.keepAlive = 60
        mqtt5!.delegate = self


        mqtt5!.allowUntrustCACertificate = true

    }

}`

`

[TRACE] [didStateChangeTo]: new state: connecting
CocoaMQTT(data): Linked to xx.xx.xx.xxx : 1883
CocoaMQTT(data): Allow backgrounding socket efficiently
CocoaMQTT(debug): SEND: CONNECT(id: CocoaMQTT-Sheep-, username: xxx, password: xxx, keepAlive : 60, cleansess: true)
CocoaMQTT(debug): =========================MQTT 3.1.1=========================
CocoaMQTT(debug): packetFixedHeaderType 16
CocoaMQTT(debug): remainingLen(len: len) [68]
CocoaMQTT(debug): variableHeader one thing
CocoaMQTT(debug): payload one thing
CocoaMQTT(debug): =============================================================
CocoaMQTT(debug): socket wrote knowledge 0
CocoaMQTT(debug): socket disconnected
[TRACE] [didDisconnect]: Error Area=NSPOSIXErrorDomain Code=54 “Connection reset by peer” UserInfo={NSLocalizedDescription=Connection reset by peer, NSLocalizedFailureReason=Error in learn() perform}
[TRACE] [didStateChangeTo]: new state: disconnected`

I used this dealer to attach a MQTT Consumer in Android utilizing the PAHO lib and the whole lot is working advantageous. Hope any person might assist indicating if is an issue in my code or an issue with the dealer.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments