Hi mestre,
Are you already signed up for a free hivemq cloud account? Once you are signed, to go your cluster and click Manage Cluster → Getting started. In the list of sample client find one that says Java(Websocket) hivemq-mqtt-client:

There you will find an example of Websocket Client: https://console.hivemq.cloud/clients/websocket-java
Take a look at the code that is building the client:
final Mqtt5BlockingClient client = MqttClient.builder()
.useMqttVersion5()
.serverHost(host)
.serverPort(8884)
.sslWithDefaultConfig()
.webSocketConfig()
.serverPath("mqtt")
.applyWebSocketConfig()
.buildBlocking();
Note a few things:
-
subprotocolis not explicitly updated, it is, by default, “mqtt”; -
serverPathis “mqtt” (like in your last attempt); - there is a call to
.applyWebSocketConfig()before.buildBlocking();
Please try to change your code this way and let us know the result. For the queryString use the part of the string that follows the “?”: “protocol://host:port/mqtt?xxx-xxx-xxx-xxx-xxx-x…”
Thanks,
Dasha from HiveMQ Team