davidepianca98 / KMQTT

Kotlin Multiplatform MQTT client & embeddable and standalone broker
MIT License
188 stars 29 forks source link

Is it possible to add a path in MqttClient? #35

Closed RobinChien closed 8 months ago

RobinChien commented 9 months ago

My MQTT broker URL is ws://broker.emqx.io:8083/mqtt. How can I specify the "/mqtt" path in the MQTTClient?

davidepianca98 commented 9 months ago

Hello, it is not yet possible, I will add the functionality when I have time. Anyway I tried to connect like this and it seems to be working anyway:

val client = MQTTClient(
    MQTTVersion.MQTT5,
    "broker.emqx.io",
    8083,
    null,
    15,
    webSocket = true
) {
    println(it.payload?.toByteArray()?.decodeToString())
}
davidepianca98 commented 8 months ago

Added in https://github.com/davidepianca98/KMQTT/commit/87b20331bd244af4bbe345c6cfc8455bfe48e5e2. Will be available in the next release