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 * @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
-
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
-
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
-
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 * @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
-
def
disconnect(): MqttClient
Disconnects from the MQTT server * @return 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 * @param 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 * @return current MQTT client instance
-
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
-
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
-
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
-
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
-
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 * @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
-
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
-
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
-
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
-
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
-
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
-
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 * @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
-
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
-
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
-
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( ... )