MQTT-Client-Framework
MQTT-Client-Framework copied to clipboard
Where can I set ssl/tsl to yes in swift code?
Short description
Environment
- Operating system: iOS, tvOS, macOS
- Software version:
- Package Manager: Cocoapods, Carthage, Manual
- MQTTClient version:
- MQTT Broker used: mosquitto, HiveMQ, vernemq, ...
Link to logs
Create a GIST which is a paste of your logs, and link them here. Please do NOT paste your full logs here, it will make issue very long and hard to read!
Steps to reproduce
Expected behaviour
Actual behaviour
Other information
Follow below setup to enable TLS
private let session = MQTTSession()!
let policy = MQTTSSLSecurityPolicy(pinningMode: .none)
policy?.allowInvalidCertificates = true
policy?.validatesCertificateChain = false
policy?.validatesDomainName = false
let transport = MQTTSSLSecurityPolicyTransport()
transport.host = "192.168.0.1"
transport.port = 8883
transport.tls = true
transport.certificates = nil
transport.securityPolicy = policy
session.transport = transport
session.delegate = self