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
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 |
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 |
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 |
Returns:
a reference to this, so the API can be used fluently
- Type
- MqttServer