vertx / io.vertx.reactivex.mqtt / MqttClient

MqttClient

open class MqttClient

An MQTT client NOTE: This class has been automatically generated from the io.vertx.mqtt.MqttClient non RX-ified interface using Vert.x codegen.

Constructors

<init>

MqttClient(delegate: MqttClient)

Properties

__TYPE_ARG

static val __TYPE_ARG: TypeArg<MqttClient>

Functions

clientId

open fun clientId(): String

closeHandler

open fun closeHandler(closeHandler: Handler<Void>): MqttClient

Set a handler that will be called when the connection with server is closed

connect

open fun connect(port: Int, host: String, connectHandler: Handler<AsyncResult<MqttConnAckMessage>>): MqttClient
open fun connect(port: Int, host: String, serverName: String, connectHandler: Handler<AsyncResult<MqttConnAckMessage>>): MqttClient

Connects to an MQTT server calling connectHandler after connection

create

open static fun create(vertx: Vertx, options: MqttClientOptions): MqttClient

Return an MQTT client instance

open static fun create(vertx: Vertx): MqttClient

Return an MQTT client instance using the default options

disconnect

open fun disconnect(): MqttClient

Disconnects from the MQTT server

open fun disconnect(disconnectHandler: Handler<AsyncResult<Void>>): MqttClient

Disconnects from the MQTT server calling disconnectHandler after disconnection

equals

open fun equals(other: Any?): Boolean

exceptionHandler

open fun exceptionHandler(handler: Handler<Throwable>): MqttClient

Set an exception handler for the client, that will be called when an error happens in internal netty structures. io.netty.handler.codec.DecoderException can be one of the cause

getDelegate

open fun getDelegate(): MqttClient

hashCode

open fun hashCode(): Int

isConnected

open fun isConnected(): Boolean

newInstance

open static fun newInstance(arg: MqttClient): MqttClient

ping

open fun ping(): MqttClient

This method is needed by the client in order to avoid server closes the connection due to the keep alive timeout if client has no messages to send

pingResponseHandler

open fun pingResponseHandler(pingResponseHandler: Handler<Void>): MqttClient

Sets handler which will be called after PINGRESP packet receiving

publish

open fun publish(topic: String, payload: Buffer, qosLevel: MqttQoS, isDup: Boolean, isRetain: Boolean): MqttClient
open fun publish(topic: String, payload: Buffer, qosLevel: MqttQoS, isDup: Boolean, isRetain: Boolean, publishSentHandler: Handler<AsyncResult<Int>>): MqttClient

Sends the PUBLISH message to the remote MQTT server

publishCompletionHandler

open fun publishCompletionHandler(publishCompletionHandler: Handler<Int>): MqttClient

Sets handler which will be called each time publish is completed

publishHandler

open fun publishHandler(publishHandler: Handler<MqttPublishMessage>): MqttClient

Sets handler which will be called each time server publish something to client

rxConnect

open fun rxConnect(port: Int, host: String): Single<MqttConnAckMessage>
open fun rxConnect(port: Int, host: String, serverName: String): Single<MqttConnAckMessage>

Connects to an MQTT server calling connectHandler after connection

rxDisconnect

open fun rxDisconnect(): Completable

Disconnects from the MQTT server calling disconnectHandler after disconnection

rxPublish

open fun rxPublish(topic: String, payload: Buffer, qosLevel: MqttQoS, isDup: Boolean, isRetain: Boolean): Single<Int>

Sends the PUBLISH message to the remote MQTT server

rxSubscribe

open fun rxSubscribe(topic: String, qos: Int): Single<Int>

Subscribes to the topic with a specified QoS level

open fun rxSubscribe(topics: MutableMap<String, Int>): Single<Int>

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

rxUnsubscribe

open fun rxUnsubscribe(topic: String): Single<Int>

Unsubscribe from receiving messages on given topic

subscribe

open fun subscribe(topic: String, qos: Int): MqttClient
open fun subscribe(topic: String, qos: Int, subscribeSentHandler: Handler<AsyncResult<Int>>): MqttClient

Subscribes to the topic with a specified QoS level

open fun subscribe(topics: MutableMap<String, Int>): MqttClient

Subscribes to the topics with related QoS levels

open fun subscribe(topics: MutableMap<String, Int>, subscribeSentHandler: Handler<AsyncResult<Int>>): MqttClient

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

subscribeCompletionHandler

open fun subscribeCompletionHandler(subscribeCompletionHandler: Handler<MqttSubAckMessage>): MqttClient

Sets handler which will be called after SUBACK packet receiving

toString

open fun toString(): String

unsubscribe

open fun unsubscribe(topic: String): MqttClient
open fun unsubscribe(topic: String, unsubscribeSentHandler: Handler<AsyncResult<Int>>): MqttClient

Unsubscribe from receiving messages on given topic

unsubscribeCompletionHandler

open fun unsubscribeCompletionHandler(unsubscribeCompletionHandler: Handler<Int>): MqttClient

Sets handler which will be called after UNSUBACK packet receiving