Open raghavgautam123 opened 4 years ago
I tried commenting as well as setting enable SSL to false and allowUntrustCACertificate to true. Still the same.
On Sun, Jan 19, 2020 at 1:27 AM raghavgautam123 notifications@github.com wrote:
I'm facing the same issue. The code I use to connect is : self.mqttClient = CocoaMQTT(clientID: clientId, host: host, port: UInt16(port)) self.mqttClient.keepAlive = 15 self.mqttClient.autoReconnect = setAutomaticReconnect self.mqttClient.delegate = self self.mqttClient.enableSSL = true self.mqttClient.allowUntrustCACertificate = true self.mqttClient.connect()
This returns error: Optional(Error Domain=kCFStreamErrorDomainSSL Code=-9806 "(null)" UserInfo={NSLocalizedRecoverySuggestion=Error code definition can be found in Apple's SecureTransport.h})
If I comment out enableSSL and allowUntrustCACertificate, it works perfectly. Server is EMQX based and works fine with all the other libraries for TLS operations except this one.
Any help by the maintainers would be appreciated. I'm kinda stuck.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/emqx/CocoaMQTT/issues/318?email_source=notifications&email_token=AE5Q2NZGRY2FY5I4JAQEAMTQ6NNMDA5CNFSM4KIU3WRKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4IHEBR4Q, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE5Q2N4HY2A4ABUPXGZPURDQ6NNMDANCNFSM4KIU3WRA .
Add this in your CocoaMQTTDelegate
func mqtt(_ mqtt: CocoaMQTT, didReceive trust: SecTrust, completionHandler: @escaping (Bool) -> Void) {
completionHandler(true)
}
This delegate is already there and has completion true also.
What is happening now is.
[TRACE] [didDisconect]: Error Domain=GCDAsyncSocketErrorDomain Code=7 "Socket closed by remote peer" UserInfo={NSLocalizedDescription=Socket closed by remote peer}
[TRACE] [didStateChangeTo]: new state: connecting
[TRACE] [didDisconect]: Error Domain=kCFStreamErrorDomainSSL Code=-9806 "(null)" UserInfo={NSLocalizedRecoverySuggestion=Error code definition can be found in Apple's SecureTransport.h}
This happen 1 in 20 times. Rest is working fine.
Did you find a solution to this problem ?
I have same problem. I have connected socket and i am trying many subscribes or unsubscribes. Sometimes i got this error. "Error Domain=GCDAsyncSocketErrorDomain Code=7 "Socket closed by remote peer" UserInfo={NSLocalizedDescription=Socket closed by remote peer}"
did u able to fix it?
Any solution found for this?
Same question 🙏
Any solutions found?
I'm not able to connect to my server using one way TLS.
The code I use to connect is : self.mqttClient = CocoaMQTT(clientID: clientId, host: host, port: UInt16(port)) self.mqttClient.keepAlive = 15 self.mqttClient.autoReconnect = setAutomaticReconnect self.mqttClient.delegate = self self.mqttClient.enableSSL = true self.mqttClient.allowUntrustCACertificate = true self.mqttClient.connect()
This returns error: Optional(Error Domain=kCFStreamErrorDomainSSL Code=-9806 "(null)" UserInfo={NSLocalizedRecoverySuggestion=Error code definition can be found in Apple's SecureTransport.h})
If I comment out enableSSL and allowUntrustCACertificate, it works perfectly. Server is EMQX based and works fine with all the other libraries for TLS operations except this one.
Any help by the maintainers would be appreciated. I'm kinda stuck.