Closed TomWangTW closed 10 months ago
@TomWangTW wss
is secure web sockets and based on the configuration you posted the endpoint the client will try is not secure (ie. ws://xxx.com:8084). You should just have to add an ssl config to get around this error, like this:
mClient = Mqtt3Client.builder()
.serverHost(host) //xxx.com
.serverPort(port) //8084
.sslWithDefaultConfig()
.webSocketConfig()
.applyWebSocketConfig()
.identifier(mqttInfo.mqttId)
.simpleAuth()
.username(mqttInfo.mqttUsername)
.password(mqttInfo.mqttPassword.toByteArray())
.applySimpleAuth()
.buildAsync();
I would strongly suggest adding disconnect/connect listeners as well to get more information about the connection, and if possible consider using MQTT5 since it is more verbose with errors. Hope that helps!
Checklist
issues
.discussions
.❓ Question
How to connect to websocket for the following setting?
address: wss://xxx.com:8084
so i seperated the address to
I used below config but it always get error like this: cause: io.netty.handler.codec.http.websocketx.WebSocketHandshakeException: Invalid handshake response getStatus: 404 Not Found
but this address is work well with eclipse mqtt client