vertx-lang-scala-docs_2.12 3.6.1 API < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package io
  Definition Classes
    root
-  package vertx
  Definition Classes
    io
-  package scala
  Definition Classes
    vertx
-  package mqtt
  Definition Classes
    scala
-  package messages
  Definition Classes
    mqtt
- MqttAuth
- MqttClient
- MqttClientOptions
- MqttEndpoint
- MqttServer
- MqttServerOptions
- MqttTopicSubscription
- MqttWill

c

io.vertx.scala.mqtt

# MqttClient 

###
Companion object MqttClient

#### class MqttClient extends AnyRef

An MQTT client

Linear Supertypes
AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. MqttClient
2. AnyRef
3. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Instance Constructors

1.  new MqttClient(_asJava: AnyRef)

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
5.  def asJava: AnyRef
6.  def clientId(): String

   returns

     the client identifier

7.  def clone(): AnyRef
   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @native() @throws( ... )
8.  def closeHandler(closeHandler: Handler[Unit]): MqttClient

   Set a handler that will be called when the connection with server is closed * @param closeHandler handler to call

   Set a handler that will be called when the connection with server is closed * @param closeHandler handler to call

   returns

     current MQTT client instance

9.  def connect(port: Int, host: String, serverName: String, connectHandler: Handler[AsyncResult[MqttConnAckMessage]]): MqttClient

   Connects to an MQTT server calling connectHandler after connection * @param port port of the MQTT server

   Connects to an MQTT server calling connectHandler after connection * @param port port of the MQTT server

   host

     hostname/ip address of the MQTT server

   serverName

     the SNI server name

   connectHandler

     handler called when the asynchronous connect call ends

   returns

     current MQTT client instance

10.  def connect(port: Int, host: String, connectHandler: Handler[AsyncResult[MqttConnAckMessage]]): MqttClient

    Connects to an MQTT server calling connectHandler after connection * @param port port of the MQTT server

    Connects to an MQTT server calling connectHandler after connection * @param port port of the MQTT server

    host

      hostname/ip address of the MQTT server

    connectHandler

      handler called when the asynchronous connect call ends

    returns

      current MQTT client instance

11.  def connectFuture(port: Int, host: String, serverName: String): Future[MqttConnAckMessage]

    Like connect but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

12.  def connectFuture(port: Int, host: String): Future[MqttConnAckMessage]

    Like connect but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

13.  def disconnect(disconnectHandler: Handler[AsyncResult[Unit]]): MqttClient

    Disconnects from the MQTT server calling disconnectHandler after disconnection * @param disconnectHandler handler called when asynchronous disconnect call ends

    Disconnects from the MQTT server calling disconnectHandler after disconnection * @param disconnectHandler handler called when asynchronous disconnect call ends

    returns

      current MQTT client instance

14.  def disconnect(): MqttClient

    Disconnects from the MQTT server * @return current MQTT client instance

15.  def disconnectFuture(): Future[Unit]

    Like disconnect but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

16.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
17.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
18.  def exceptionHandler(handler: Handler[Throwable]): MqttClient

    Set an exception handler for the client, that will be called when an error happens in internal netty structures.

    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 * @param handler the exception handler

    returns

      current MQTT client instance

19.  def finalize(): Unit
    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
20.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
21.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
22.  def isConnected(): Boolean

    returns

      if the connection between client and remote server is established/open

23.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
24.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
25.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
26.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
27.  def 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 * @return current MQTT client instance

28.  def pingResponseHandler(pingResponseHandler: Handler[Unit]): MqttClient

    Sets handler which will be called after PINGRESP packet receiving * @param pingResponseHandler handler to call

    Sets handler which will be called after PINGRESP packet receiving * @param pingResponseHandler handler to call

    returns

      current MQTT client instance

29.  def 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 * @param topic topic on which the message is published

    Sends the PUBLISH message to the remote MQTT server * @param topic topic on which the message is published

    payload

      message payload

    qosLevel

      QoS level

    isDup

      if the message is a duplicate

    isRetain

      if the message needs to be retained

    publishSentHandler

      handler called after PUBLISH packet sent with packetid (not when QoS 0)

    returns

      current MQTT client instance

30.  def publish(topic: String, payload: Buffer, qosLevel: MqttQoS, isDup: Boolean, isRetain: Boolean): MqttClient

    Sends the PUBLISH message to the remote MQTT server * @param topic topic on which the message is published

    Sends the PUBLISH message to the remote MQTT server * @param topic topic on which the message is published

    payload

      message payload

    qosLevel

      QoS level

    isDup

      if the message is a duplicate

    isRetain

      if the message needs to be retained

    returns

      current MQTT client instance

31.  def publishCompletionHandler(publishCompletionHandler: Handler[Int]): MqttClient

    Sets handler which will be called each time publish is completed * @param publishCompletionHandler handler called with the packetId

    Sets handler which will be called each time publish is completed * @param publishCompletionHandler handler called with the packetId

    returns

      current MQTT client instance

32.  def publishFuture(topic: String, payload: Buffer, qosLevel: MqttQoS, isDup: Boolean, isRetain: Boolean): Future[Int]

    Like publish but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

33.  def publishHandler(publishHandler: Handler[MqttPublishMessage]): MqttClient

    Sets handler which will be called each time server publish something to client * @param publishHandler handler to call

    Sets handler which will be called each time server publish something to client * @param publishHandler handler to call

    returns

      current MQTT client instance

34.  def subscribe(topics: Map[String, Int], subscribeSentHandler: Handler[AsyncResult[Int]]): MqttClient

    Subscribes to the topic and adds a handler which will be called after the request is sent * @param topics topics you subscribe on

    Subscribes to the topic and adds a handler which will be called after the request is sent * @param topics topics you subscribe on

    subscribeSentHandler

      handler called after SUBSCRIBE packet sent with packetid

    returns

      current MQTT client instance

35.  def subscribe(topics: Map[String, Int]): MqttClient

    Subscribes to the topics with related QoS levels * @param topics topics and related QoS levels to subscribe to

    Subscribes to the topics with related QoS levels * @param topics topics and related QoS levels to subscribe to

    returns

      current MQTT client instance

36.  def subscribe(topic: String, qos: Int, subscribeSentHandler: Handler[AsyncResult[Int]]): MqttClient

    Subscribes to the topic with a specified QoS level * @param topic topic you subscribe on

    Subscribes to the topic with a specified QoS level * @param topic topic you subscribe on

    qos

      QoS level

    subscribeSentHandler

      handler called after SUBSCRIBE packet sent with packetid

    returns

      current MQTT client instance

37.  def subscribe(topic: String, qos: Int): MqttClient

    Subscribes to the topic with a specified QoS level * @param topic topic you subscribe on

    Subscribes to the topic with a specified QoS level * @param topic topic you subscribe on

    qos

      QoS level

    returns

      current MQTT client instance

38.  def subscribeCompletionHandler(subscribeCompletionHandler: Handler[MqttSubAckMessage]): MqttClient

    Sets handler which will be called after SUBACK packet receiving * @param subscribeCompletionHandler handler to call.

    Sets handler which will be called after SUBACK packet receiving * @param subscribeCompletionHandler handler to call. List inside is a granted QoS array

    returns

      current MQTT client instance

39.  def subscribeFuture(topics: Map[String, Int]): Future[Int]

    Like subscribe but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

40.  def subscribeFuture(topic: String, qos: Int): Future[Int]

    Like subscribe but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

41.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
42.  def toString(): String
    Definition Classes
      AnyRef → Any
43.  def unsubscribe(topic: String, unsubscribeSentHandler: Handler[AsyncResult[Int]]): MqttClient

    Unsubscribe from receiving messages on given topic * @param topic Topic you want to unsubscribe from

    Unsubscribe from receiving messages on given topic * @param topic Topic you want to unsubscribe from

    unsubscribeSentHandler

      handler called after UNSUBSCRIBE packet sent

    returns

      current MQTT client instance

44.  def unsubscribe(topic: String): MqttClient

    Unsubscribe from receiving messages on given topic * @param topic Topic you want to unsubscribe from

    Unsubscribe from receiving messages on given topic * @param topic Topic you want to unsubscribe from

    returns

      current MQTT client instance

45.  def unsubscribeCompletionHandler(unsubscribeCompletionHandler: Handler[Int]): MqttClient

    Sets handler which will be called after UNSUBACK packet receiving * @param unsubscribeCompletionHandler handler to call with the packetid

    Sets handler which will be called after UNSUBACK packet receiving * @param unsubscribeCompletionHandler handler to call with the packetid

    returns

      current MQTT client instance

46.  def unsubscribeFuture(topic: String): Future[Int]

    Like unsubscribe but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

47.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
48.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
49.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @native() @throws( ... )

### Inherited from AnyRef

### Inherited from Any

### Ungrouped