Class: MqttServer

vertx-mqtt-server-js/mqtt_server~ MqttServer

new MqttServer()

An MQTT server

Source:

Methods

actualPort() → {number}

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
Source:
Returns:
the actual port the server is listening on.
Type
number

close(completionHandler)

Close the server supplying an handler that will be called when the server is actually closed (or has failed).
Parameters:
Name Type Description
completionHandler function the handler called on completion
Source:

endpointHandler(handler) → {MqttServer}

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
Parameters:
Name Type Description
handler function the endpoint handler
Source:
Returns:
a reference to this, so the API can be used fluently
Type
MqttServer

exceptionHandler(handler) → {MqttServer}

Set an exception handler for the server, that will be called when an error happens independantly of an accepted MqttEndpoint, like a rejected connection
Parameters:
Name Type Description
handler function the exception handler
Source:
Returns:
a reference to this, so the API can be used fluently
Type
MqttServer

listen(port, host, listenHandler) → {MqttServer}

Start the server listening for incoming connections on the port and host specified It ignores any options specified through the constructor
Parameters:
Name Type Description
port number the port to listen on
host string the host to listen on
listenHandler function handler called when the asynchronous listen call ends
Source:
Returns:
a reference to this, so the API can be used fluently
Type
MqttServer