An MQTT client
package |
Default |
---|
__construct()
clientId() : string
string
the client identifier
closeHandler( $arg0) : $this
callable
$this
current MQTT client instance
connect( $arg0, $arg1, $arg2, $arg3 = null) : $this
param $port [integer] port of the MQTT server param $host [string] hostname/ip address of the MQTT server param $connectHandler [callable] handler called when the asynchronous connect call ends connect($port, $host, $connectHandler)
Connects to an MQTT server calling connectHandler after connection
param $port [integer] port of the MQTT server param $host [string] hostname/ip address of the MQTT server param $serverName [string] the SNI server name param $connectHandler [callable] handler called when the asynchronous connect call ends connect($port, $host, $serverName, $connectHandler)
integer
string
callable | string
callable
$this
current MQTT client instance
create( $arg0, $arg1 = null) : \io\vertx\jphp\mqtt\MqttClient
param $vertx [Vertx] Vert.x instance create($vertx)
Return an MQTT client instance
param $vertx [Vertx] Vert.x instance param $options [MqttClientOptions | array] MQTT client options create($vertx, $options)
Vertx
array | MqttClientOptions
\io\vertx\jphp\mqtt\MqttClient
MQTT client instance
disconnect( $arg0 = null) : $this
disconnect()
Disconnects from the MQTT server calling disconnectHandler after disconnection
param $disconnectHandler [callable] handler called when asynchronous disconnect call ends disconnect($disconnectHandler)
callable
$this
current MQTT client instance
exceptionHandler( $arg0) : $this
io.netty.handler.codec.DecoderException
can be one of the cause
callable
$this
current MQTT client instance
isConnected() : boolean
boolean
if the connection between client and remote server is established/open
ping() : $this
$this
current MQTT client instance
pingResponseHandler( $arg0) : $this
callable
$this
current MQTT client instance
publish( $arg0, $arg1, $arg2, $arg3, $arg4, $arg5 = null) : $this
param $topic [string] topic on which the message is published param $payload [Buffer] message payload param $qosLevel [string] QoS level param $isDup [boolean] if the message is a duplicate param $isRetain [boolean] if the message needs to be retained publish($topic, $payload, $qosLevel, $isDup, $isRetain)
Sends the PUBLISH message to the remote MQTT server
param $topic [string] topic on which the message is published param $payload [Buffer] message payload param $qosLevel [string] QoS level param $isDup [boolean] if the message is a duplicate param $isRetain [boolean] if the message needs to be retained param $publishSentHandler [callable] handler called after PUBLISH packet sent with packetid (not when QoS 0) publish($topic, $payload, $qosLevel, $isDup, $isRetain, $publishSentHandler)
string
Buffer
string
boolean
boolean
callable
$this
current MQTT client instance
publishCompletionHandler( $arg0) : $this
callable
$this
current MQTT client instance
publishHandler( $arg0) : $this
callable
$this
current MQTT client instance
subscribe( $arg0, $arg1 = null, $arg2 = null) : $this
param $topics [array] topics and related QoS levels to subscribe to subscribe($topics)
Subscribes to the topic with a specified QoS level
param $topic [string] topic you subscribe on param $qos [integer] QoS level subscribe($topic, $qos)
Subscribes to the topic and adds a handler which will be called after the request is sent
param $topics [array] topics you subscribe on param $subscribeSentHandler [callable] handler called after SUBSCRIBE packet sent with packetid subscribe($topics, $subscribeSentHandler)
Subscribes to the topic with a specified QoS level
param $topic [string] topic you subscribe on param $qos [integer] QoS level param $subscribeSentHandler [callable] handler called after SUBSCRIBE packet sent with packetid subscribe($topic, $qos, $subscribeSentHandler)
string | array
callable | integer
callable
$this
current MQTT client instance
subscribeCompletionHandler( $arg0) : $this
callable
$this
current MQTT client instance
unsubscribe( $arg0, $arg1 = null) : $this
param $topic [string] Topic you want to unsubscribe from unsubscribe($topic)
Unsubscribe from receiving messages on given topic
param $topic [string] Topic you want to unsubscribe from param $unsubscribeSentHandler [callable] handler called after UNSUBSCRIBE packet sent unsubscribe($topic, $unsubscribeSentHandler)
string
callable
$this
current MQTT client instance
unsubscribeCompletionHandler( $arg0) : $this
callable
$this
current MQTT client instance