Interface IMqtt5Client

Shared MQTT5 client interface across browser and node.

Common event manipulation patterns have explicit functions separate from the EventListener interface because creating an abstract event listening interface in typescript eludes me.

Hierarchy

  • IMqtt5Client

Implemented by

Methods

  • Triggers cleanup of native resources associated with the MQTT5 client. Once this has been invoked, callbacks and events are not guaranteed to be received.

    On the browser, the implementation is an empty function.

    On Node, this must be called when finished with a client; otherwise, native resources will leak. It is not safe to invoke any further operations on the client after close() has been called.

    For a running client, safe and proper shutdown can be accomplished by

    const stopped = once(client, "stopped");
    client.stop();
    await stopped;
    client.close();

    This is an asynchronous operation.

    Returns void

  • Send a message to subscribing clients by queuing a PUBLISH packet to be sent to the server.

    Parameters

    Returns Promise<PublishCompletionResult>

    a promise that will be rejected with an error or resolved with the PUBACK response

  • Notifies the MQTT5 client that you want it to maintain connectivity to the configured endpoint. The client will attempt to stay connected using the properties of the reconnect-related parameters in the mqtt5 client configuration.

    This is an asynchronous operation.

    Returns void

  • Notifies the MQTT5 client that you want it to end connectivity to the configured endpoint, disconnecting any existing connection and halting reconnection attempts.

    This is an asynchronous operation. Once the process completes, no further events will be emitted until the client has start invoked.

    Parameters

    Returns void

  • Subscribe to one or more topic filters by queuing a SUBSCRIBE packet to be sent to the server.

    Parameters

    Returns Promise<SubackPacket>

    a promise that will be rejected with an error or resolved with the SUBACK response

  • Unsubscribe from one or more topic filters by queuing an UNSUBSCRIBE packet to be sent to the server.

    Parameters

    Returns Promise<UnsubackPacket>

    a promise that will be rejected with an error or resolved with the UNSUBACK response

Generated using TypeDoc