vertx / io.vertx.kotlin.mqtt / io.vertx.mqtt.MqttClient

Extensions for io.vertx.mqtt.MqttClient

connectAwait

suspend fun MqttClient.connectAwait(port: Int, host: String): MqttConnAckMessage
suspend fun MqttClient.connectAwait(port: Int, host: String, serverName: String): MqttConnAckMessage

Connects to an MQTT server calling connectHandler after connection

disconnectAwait

suspend fun MqttClient.disconnectAwait(): Unit

Disconnects from the MQTT server calling disconnectHandler after disconnection

publishAwait

suspend fun MqttClient.publishAwait(topic: String, payload: Buffer, qosLevel: MqttQoS, isDup: Boolean, isRetain: Boolean): Int

Sends the PUBLISH message to the remote MQTT server

subscribeAwait

suspend fun MqttClient.subscribeAwait(topic: String, qos: Int): Int

Subscribes to the topic with a specified QoS level

suspend fun MqttClient.subscribeAwait(topics: Map<String, Int>): Int

Subscribes to the topic and adds a handler which will be called after the request is sent

unsubscribeAwait

suspend fun MqttClient.unsubscribeAwait(topic: String): Int

Unsubscribe from receiving messages on given topic