Dear Solace Community Team,
I’m encountering an issue while trying to connect to the Solace broker over MQTT using CocoaMQTT. Specifically, the connection attempt is being dropped with the error:
Error Domain=NSURLErrorDomain Code=-1005 "The network connection was lost."
The logs indicate that the connection is being lost after initiating the SSL/TLS handshake with the broker at https://mr-connection-cighcgrbttl.messaging.solace.cloud:443/mqtt
.
Details:
- Protocol:
wss://
(WebSocket Secure) for port443
, which is the expected secure WebSocket connection. - CocoaMQTT Version: [Provide version]
- Broker URL:
https://mr-connection-cighcgrbttl.messaging.solace.cloud:443/mqtt
- Error Message: The network connection was lost (
NSURLErrorDomain Code=-1005
). - Trust Information: The logs show the trust being received, indicating that SSL handshake is occurring, but the connection still fails.
- Other Observations:
- The connection state changes from “connecting” to “disconnected.”
- The issue persists even after switching networks (tried mobile hotspot and other networks).
- The connection fails every time at the same point.
iOS swift code :
let clientID = "CocoaMQTT-\(animal!)-" + String(ProcessInfo().processIdentifier)
let websocket = CocoaMQTTWebSocket(uri: "/mqtt")
mqtt = CocoaMQTT(clientID: clientID, host: defaultHost, port: 443, socket: websocket)
let username = "solace-cloud-client"
mqtt!.username = username
mqtt!.password = "oc1h2uejbmurk5r7fjv296v07a"
mqtt!.willMessage = CocoaMQTTMessage(topic: "topic1", string: "dieout")
mqtt!.keepAlive = 60
mqtt!.delegate = self
mqtt!.enableSSL = true