class MqttClient extends AnyRef
An MQTT client
- Alphabetic
- By Inheritance
- MqttClient
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new MqttClient(_asJava: AnyRef)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
- def asJava: AnyRef
-
def
clientId(): String
- returns
the client identifier
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
closeHandler(closeHandler: Handler[Unit]): MqttClient
Set a handler that will be called when the connection with server is closed
Set a handler that will be called when the connection with server is closed
- closeHandler
handler to call
- returns
current MQTT client instance
-
def
connect(port: Int, host: String, serverName: String, connectHandler: Handler[AsyncResult[MqttConnAckMessage]]): MqttClient
Connects to an MQTT server calling connectHandler after connection
Connects to an MQTT server calling connectHandler after connection
- 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
-
def
connect(port: Int, host: String, connectHandler: Handler[AsyncResult[MqttConnAckMessage]]): MqttClient
Connects to an MQTT server calling connectHandler after connection
Connects to an MQTT server calling connectHandler after connection
- 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
-
def
connectFuture(port: Int, host: String, serverName: String): Future[MqttConnAckMessage]
Like connect but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
connectFuture(port: Int, host: String): Future[MqttConnAckMessage]
Like connect but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
disconnect(disconnectHandler: Handler[AsyncResult[Unit]]): MqttClient
Disconnects from the MQTT server calling disconnectHandler after disconnection
Disconnects from the MQTT server calling disconnectHandler after disconnection
- disconnectHandler
handler called when asynchronous disconnect call ends
- returns
current MQTT client instance
-
def
disconnect(): MqttClient
Disconnects from the MQTT server
Disconnects from the MQTT server
- returns
current MQTT client instance
-
def
disconnectFuture(): Future[Unit]
Like disconnect but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
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- handler
the exception handler
- returns
current MQTT client instance
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
isConnected(): Boolean
- returns
if the connection between client and remote server is established/open
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
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
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
- returns
current MQTT client instance
-
def
pingResponseHandler(pingResponseHandler: Handler[Unit]): MqttClient
Sets handler which will be called after PINGRESP packet receiving
Sets handler which will be called after PINGRESP packet receiving
- pingResponseHandler
handler to call
- returns
current MQTT client instance
-
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
Sends the PUBLISH message to the remote MQTT server
- 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
-
def
publish(topic: String, payload: Buffer, qosLevel: MqttQoS, isDup: Boolean, isRetain: Boolean): MqttClient
Sends the PUBLISH message to the remote MQTT server
Sends the PUBLISH message to the remote MQTT server
- 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
-
def
publishCompletionHandler(publishCompletionHandler: Handler[Int]): MqttClient
Sets handler which will be called each time publish is completed
Sets handler which will be called each time publish is completed
- publishCompletionHandler
handler called with the packetId
- returns
current MQTT client instance
-
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.
-
def
publishHandler(publishHandler: Handler[MqttPublishMessage]): MqttClient
Sets handler which will be called each time server publish something to client
Sets handler which will be called each time server publish something to client
- publishHandler
handler to call
- returns
current MQTT client instance
-
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
Subscribes to the topic and adds a handler which will be called after the request is sent
- topics
topics you subscribe on
- subscribeSentHandler
handler called after SUBSCRIBE packet sent with packetid
- returns
current MQTT client instance
-
def
subscribe(topics: Map[String, Int]): MqttClient
Subscribes to the topics with related QoS levels
Subscribes to the topics with related QoS levels
- topics
topics and related QoS levels to subscribe to
- returns
current MQTT client instance
-
def
subscribe(topic: String, qos: Int, subscribeSentHandler: Handler[AsyncResult[Int]]): MqttClient
Subscribes to the topic with a specified QoS level
Subscribes to the topic with a specified QoS level
- topic
topic you subscribe on
- qos
QoS level
- subscribeSentHandler
handler called after SUBSCRIBE packet sent with packetid
- returns
current MQTT client instance
-
def
subscribe(topic: String, qos: Int): MqttClient
Subscribes to the topic with a specified QoS level
Subscribes to the topic with a specified QoS level
- topic
topic you subscribe on
- qos
QoS level
- returns
current MQTT client instance
-
def
subscribeCompletionHandler(subscribeCompletionHandler: Handler[MqttSubAckMessage]): MqttClient
Sets handler which will be called after SUBACK packet receiving
Sets handler which will be called after SUBACK packet receiving
- subscribeCompletionHandler
handler to call. List inside is a granted QoS array
- returns
current MQTT client instance
-
def
subscribeFuture(topics: Map[String, Int]): Future[Int]
Like subscribe but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
subscribeFuture(topic: String, qos: Int): Future[Int]
Like subscribe but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
def
unsubscribe(topic: String, unsubscribeSentHandler: Handler[AsyncResult[Int]]): MqttClient
Unsubscribe from receiving messages on given topic
Unsubscribe from receiving messages on given topic
- topic
Topic you want to unsubscribe from
- unsubscribeSentHandler
handler called after UNSUBSCRIBE packet sent
- returns
current MQTT client instance
-
def
unsubscribe(topic: String): MqttClient
Unsubscribe from receiving messages on given topic
Unsubscribe from receiving messages on given topic
- topic
Topic you want to unsubscribe from
- returns
current MQTT client instance
-
def
unsubscribeCompletionHandler(unsubscribeCompletionHandler: Handler[Int]): MqttClient
Sets handler which will be called after UNSUBACK packet receiving
Sets handler which will be called after UNSUBACK packet receiving
- unsubscribeCompletionHandler
handler to call with the packetid
- returns
current MQTT client instance
-
def
unsubscribeFuture(topic: String): Future[Int]
Like unsubscribe but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )