Open vidhya11v opened 3 years ago
This is the code which I tried
let sessionManager = MQTTSessionManager() sessionManager.delegate = self
let userName = "" let password = "" let certificate = Bundle.main.path(forResource: "ca", ofType: "crt") let securityPolicy = MQTTSSLSecurityPolicy.init(pinningMode: .certificate) securityPolicy?.allowInvalidCertificates = true securityPolicy?.pinnedCertificates = [NSData.init(contentsOfFile: certificate!)!] securityPolicy?.validatesCertificateChain = false securityPolicy?.validatesDomainName = false sessionManager.connect(to: MQTT_HOST, port: Int(MQTT_PORT), tls: true, keepalive: 60, clean: true, auth: false, user: nil, pass: nil, will: false, willTopic: nil, willMsg: nil, willQos: .atMostOnce, willRetainFlag: false, withClientId: "client-1", securityPolicy: securityPolicy, certificates: [NSData.init(contentsOfFile: certificate!)!], protocolLevel: .version311, connectHandler:nil )
This is the code which I tried
let sessionManager = MQTTSessionManager() sessionManager.delegate = self