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.
Send a message to subscribing clients by queuing a PUBLISH packet to be sent to the server.
PUBLISH packet to send to the server
a promise that will be rejected with an error or resolved with the PUBACK response
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.
Optional
packet: DisconnectPacket(optional) properties of a DISCONNECT packet to send as part of the shutdown process
Subscribe to one or more topic filters by queuing a SUBSCRIBE packet to be sent to the server.
SUBSCRIBE packet to send to the server
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.
UNSUBSCRIBE packet to send to the server
a promise that will be rejected with an error or resolved with the UNSUBACK response
Generated using TypeDoc
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.