Closed RajaReddyiOS closed 4 years ago
MQTTWebsocketTransport auto connect is not working once network is back
Using this format: let session = MQTTSession(clientId: "ClientID", userName: "userName", password: "***", keepAlive: UInt16(MQTTClientServices.KEEP_ALIVE_TIME), connect: nil, cleanSession: true, will: false, willTopic: nil, willMsg: nil, willQoS: MQTTQosLevel.atLeastOnce, willRetainFlag: true, protocolLevel: MQTTProtocolVersion.version311.rawValue, queue: DispatchQueue.main, securityPolicy: nil, certificates: nil)
let transport = MQTTWebsocketTransport() let url = URL(string: "wss://host:port/mqtt") transport.url = url session?.transport = transport self.session = session self.session?.delegate = self self.session!.connect { (error) in print("error message: \(String(describing: error))") },
Thanks in advance
MQTTWebSocketTransport on its own doesn't implement auto reconnect. If you need that behaviour you can implement that in your application.
MQTTWebSocketTransport
MQTTWebsocketTransport auto connect is not working once network is back
Using this format: let session = MQTTSession(clientId: "ClientID", userName: "userName", password: "***", keepAlive: UInt16(MQTTClientServices.KEEP_ALIVE_TIME), connect: nil, cleanSession: true, will: false, willTopic: nil, willMsg: nil, willQoS: MQTTQosLevel.atLeastOnce, willRetainFlag: true, protocolLevel: MQTTProtocolVersion.version311.rawValue, queue: DispatchQueue.main, securityPolicy: nil, certificates: nil)
Thanks in advance