Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MqttServer

An MQTT server

You can accept incoming MQTT connection requests providing a {@link MqttServer#endpointHandler}. As the requests arrive, the handler will be called with an instance of MqttEndpoint in order to manage the communication with the remote MQTT client.

Hierarchy

  • MqttServer

Index

Methods

actualPort

  • 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 number

close

  • close(): PromiseLike<void>
  • close(completionHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Close the server supplying an handler that will be called when the server is actually closed (or has failed).

    Returns PromiseLike<void>

  • Close the server supplying an handler that will be called when the server is actually closed (or has failed).

    Parameters

    • completionHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

endpointHandler

  • 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

    Returns MqttServer

exceptionHandler

  • exceptionHandler(handler: ((res: Throwable) => void) | Handler<Throwable>): 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

    • handler: ((res: Throwable) => void) | Handler<Throwable>

    Returns MqttServer

listen

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

    Parameters

    • port: number
    • host: string

    Returns PromiseLike<MqttServer>

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

    Parameters

    • port: number
    • host: string
    • listenHandler: ((res: AsyncResult<MqttServer>) => void) | Handler<AsyncResult<MqttServer>>

    Returns MqttServer

  • 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

    Parameters

    • port: number

    Returns PromiseLike<MqttServer>

  • 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

    Parameters

    • port: number
    • listenHandler: ((res: AsyncResult<MqttServer>) => void) | Handler<AsyncResult<MqttServer>>

    Returns MqttServer

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

    Returns PromiseLike<MqttServer>

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

    Parameters

    Returns MqttServer

Static create

  • Return an MQTT server instance

    Parameters

    Returns MqttServer

  • Return an MQTT server instance using default options

    Parameters

    • vertx: Vertx

    Returns MqttServer

Generated using TypeDoc