MqttServer

An MQTT server <p> You can accept incoming MQTT connection requests providing a @see \io\vertx\jphp\mqtt\MqttServer::endpointHandler. As the requests arrive, the handler will be called with an instance of @see \io\vertx\jphp\mqtt\MqttEndpoint in order to manage the communication with the remote MQTT client.

package

Default

Methods

__construct

__construct() 

The actual port the server is listening on. This is useful if you bound the server specifying 0 as port number signifying an ephemeral port

actualPort() : integer

Response

integer

the actual port the server is listening on.

Close the server.

close( $arg0 = null) : void

The close happens asynchronously and the server may not be closed until some time after the call has returned. close() Close the server supplying an handler that will be called when the server is actually closed (or has failed). param $completionHandler [callable] the handler called on completion close($completionHandler)

Arguments

$arg0

callable

Return an MQTT server instance using default options

create( $arg0,  $arg1 = null) : \io\vertx\jphp\mqtt\MqttServer
static

param $vertx [Vertx] Vert.x instance create($vertx)

Return an MQTT server instance

param $vertx [Vertx] Vert.x instance param $options [MqttServerOptions | array] MQTT server options create($vertx, $options)

Arguments

$arg0

Vertx

$arg1

array | MqttServerOptions

Response

\io\vertx\jphp\mqtt\MqttServer

MQTT server instance

Set the endpoint handler for the server. If an MQTT client connect to the server a new MqttEndpoint instance will be created and passed to the handler

endpointHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

a reference to this, so the API can be used fluently

Set an exception handler for the server, that will be called when an error happens independantly of an accepted @see \io\vertx\jphp\mqtt\MqttEndpoint, like a rejected connection

exceptionHandler( $arg0) : $this

Arguments

$arg0

callable

Response

$this

a reference to this, so the API can be used fluently

Start the server listening for incoming connections using the specified options through the constructor

listen( $arg0 = null,  $arg1 = null,  $arg2 = null) : $this

listen()

Start the server listening for incoming connections on the port specified but on "0.0.0.0" as host. It ignores any options specified through the constructor

param $port [integer] the port to listen on listen($port)

Start the server listening for incoming connections using the specified options through the constructor

param $listenHandler [callable] handler called when the asynchronous listen call ends listen($listenHandler)

Start the server listening for incoming connections on the port and host specified

param $port [integer] the port to listen on param $host [string] the host to listen on listen($port, $host)

Start the server listening for incoming connections on the port specified but on "0.0.0.0" as host. It ignores any options specified through the constructor

param $port [integer] the port to listen on param $listenHandler [callable] handler called when the asynchronous listen call ends listen($port, $listenHandler)

Start the server listening for incoming connections on the port and host specified It ignores any options specified through the constructor

param $port [integer] the port to listen on param $host [string] the host to listen on param $listenHandler [callable] handler called when the asynchronous listen call ends listen($port, $host, $listenHandler)

Arguments

$arg0

callable | integer

$arg1

callable | string

$arg2

callable

Response

$this

a reference to this, so the API can be used fluently