Open leonardo-miguel-silva-alb opened 1 month ago
Hi, As the titles indicates my client is closing after receiving 0 data from broker. My broker uses a Self Signed Certificate. Next I will indicate 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(info): Connected to xx.xx.xx.xxx : 1883 CocoaMQTT(info): Enable backgrounding socket successfully 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 something CocoaMQTT(debug): payload something CocoaMQTT(debug): ============================================================= CocoaMQTT(debug): socket wrote data 0 CocoaMQTT(debug): socket disconnected
[TRACE] [didDisconnect]: Error Domain=NSPOSIXErrorDomain Code=54 "Connection reset by peer" UserInfo={NSLocalizedDescription=Connection reset by peer, NSLocalizedFailureReason=Error in read() function} [TRACE] [didStateChangeTo]: new state: disconnected`
+1
Hi, As the titles indicates my client is closing after receiving 0 data from broker. My broker uses a Self Signed Certificate. Next I will indicate my code and logs
`
func selfSignedSSLSetting() { if mqttVesion == "3.1.1" {
CocoaMQTT(info): Connected to xx.xx.xx.xxx : 1883 CocoaMQTT(info): Enable backgrounding socket successfully 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 something CocoaMQTT(debug): payload something CocoaMQTT(debug): ============================================================= CocoaMQTT(debug): socket wrote data 0 CocoaMQTT(debug): socket disconnected
[TRACE] [didDisconnect]: Error Domain=NSPOSIXErrorDomain Code=54 "Connection reset by peer" UserInfo={NSLocalizedDescription=Connection reset by peer, NSLocalizedFailureReason=Error in read() function} [TRACE] [didStateChangeTo]: new state: disconnected`