CocoaMQTTSocket - emqx/CocoaMQTT GitHub Wiki
CocoaMQTTSocket
public class CocoaMQTTSocket: NSObject
Inheritance
CocoaMQTTSocketProtocol
, GCDAsyncSocketDelegate
, NSObject
Initializers
init()
public override init()
Properties
backgroundOnSocket
public var backgroundOnSocket = true
enableSSL
public var enableSSL = false
sslSettings
public var sslSettings: [String: NSObject]?
allowUntrustCACertificate
Allow self-signed ca certificate.
public var allowUntrustCACertificate = false
Default is false
Methods
setDelegate(_:delegateQueue:)
public func setDelegate(_ theDelegate: CocoaMQTTSocketDelegate?, delegateQueue: DispatchQueue?)
connect(toHost:onPort:)
public func connect(toHost host: String, onPort port: UInt16) throws
connect(toHost:onPort:withTimeout:)
public func connect(toHost host: String, onPort port: UInt16, withTimeout timeout: TimeInterval) throws
disconnect()
public func disconnect()
readData(toLength:withTimeout:tag:)
public func readData(toLength length: UInt, withTimeout timeout: TimeInterval, tag: Int)
write(_:withTimeout:tag:)
public func write(_ data: Data, withTimeout timeout: TimeInterval, tag: Int)
socket(_:didConnectToHost:port:)
public func socket(_ sock: GCDAsyncSocket, didConnectToHost host: String, port: UInt16)
socket(_:didReceive:completionHandler:)
public func socket(_ sock: GCDAsyncSocket, didReceive trust: SecTrust, completionHandler: @escaping (Bool) -> Swift.Void)
socketDidSecure(_:)
public func socketDidSecure(_ sock: GCDAsyncSocket)
socket(_:didWriteDataWithTag:)
public func socket(_ sock: GCDAsyncSocket, didWriteDataWithTag tag: Int)
socket(_:didRead:withTag:)
public func socket(_ sock: GCDAsyncSocket, didRead data: Data, withTag tag: Int)
socketDidDisconnect(_:withError:)
public func socketDidDisconnect(_ sock: GCDAsyncSocket, withError err: Error?)