CocoaMQTT
CocoaMQTT copied to clipboard
Is it possible to connect over wss?
I´m trying to connect with the following code:
let clientID = "CocoaMQTT-" + String(ProcessInfo().processIdentifier)
// myHost: wss://myserver.test:9001
let mqtt = CocoaMQTT(clie.ntID: clientID, host: "myserver.test", port: 9001)
mqtt.keepAlive = 10000
mqtt.username = "username"
mqtt.password = "password"
mqtt.enableSSL = true
mqtt.delegate = self
mqtt.connect()
mqtt.autoReconnect = true
I get the error: Error Domain=GCDAsyncSocketErrorDomain Code=7 "Socket closed by remote peer" UserInfo={NSLocalizedDescription=Socket closed by remote peer}
Does CocoaMQTT support wss or only tcp?
@NathanMrtns The library still not supports MQTT over Websocket.
Is there any library support MQTT over Websocket ? @emqplus
@yusufonderd Do you want to connect to a MQTT broker in a WebView? If so you could use mqttws31.js. Or you could try MQTT-Client-Framework.
@terry-xiaoyu I tried MQTT-Client-Framework but it didn't work. You can look my issue from link : https://github.com/novastone-media/MQTT-Client-Framework/issues/458. How can I use MQTT broker in WebView ? I don't understand. Can you help me ?
Hey @yusufonderd I replied your post there. Check if it works
@NathanMrtns unfortunately it doesn't work.
Now support WSS? @HJianBo
Got answer from https://github.com/emqx/CocoaMQTT/issues/174. seems not support WSS now. Pls let me know if support now.