April 2017
Intermediate to advanced
280 pages
6h 18m
English
The CocoaMQTT client is very easy to use. First, it is necessary to import CocoaMQTT, create an instance of the CocoaMQTT class, specify the MQTT connection configuration values, and indicate an instance of a class that conforms to the CocoaMQTTDelegate protocol. We can call the methods for the created CocoaMQTT instance to subscribe to topics and publish messages.
Let's take a look at the code that declares the CocoaMQTTDelegate protocol:
@objc public protocol CocoaMQTTDelegate { func mqtt(_ mqtt: CocoaMQTT, didConnect host: String, port: Int) func mqtt(_ mqtt: CocoaMQTT, didConnectAck ack: CocoaMQTTConnAck) func mqtt(_ mqtt: CocoaMQTT, didPublishMessage message: CocoaMQTTMessage, id: UInt16) func ...Read now
Unlock full access