emqx / qmqtt

MQTT client for Qt
https://www.emqx.com
Other
698 stars 337 forks source link

Can I connect server using wss:/host:port/mqtt? #257

Closed qwyinxiang closed 2 weeks ago

qwyinxiang commented 1 month ago

Can I connect mqtt server using wss,is there any examples? thank you very much.

ejvr commented 1 month ago

Yes, it's possible. Some time ago I wrote a small demo project which illustrates how to connect.

You can find it here

Take a look at the function QmlQmqttClient::connectToHost() for details on the connection.

To use websockets you have to compile QMQTT with websocket support (I think it's disabled by default). See QMQTT's readme for details on how to build.