The client that owns this connection
The configuration for this connection
Optional
Readonly
tls_Readonly
clientThe client that owns this connection
Open the actual connection to the server (async).
A Promise which completes whether the connection succeeds or fails. If connection fails, the Promise will reject with an exception. If connection succeeds, the Promise will return a boolean that is true for resuming an existing session, or false if the session is new
The connection will automatically reconnect when disconnected, removing the need for this function. To cease automatic reconnection attempts, call disconnect.
Publish message (async). If the device is offline, the PUBLISH packet will be sent once the connection resumes.
Promise which returns a MqttRequest which will contain the packet id of the PUBLISH packet.
Subscribe to a topic filter (async). The client sends a SUBSCRIBE packet and the server responds with a SUBACK.
subscribe() may be called while the device is offline, though the async operation cannot complete successfully until the connection resumes.
Once subscribed, callback
is invoked each time a message matching
the topic
is received. It is possible for such messages to arrive before
the SUBACK is received.
Subscribe to this topic filter, which may include wildcards
Maximum requested QoS that server may use when sending messages to the client. The server may grant a lower QoS in the SUBACK
Optional
on_message: OnMessageCallbackOptional callback invoked when message received.
Promise which returns a MqttSubscribeRequest which will contain the result of the SUBSCRIBE. The Promise resolves when a SUBACK is returned from the server or is rejected when an exception occurs.
Unsubscribe from a topic filter (async). The client sends an UNSUBSCRIBE packet, and the server responds with an UNSUBACK.
The topic filter to unsubscribe from. May contain wildcards.
Promise wihch returns a MqttRequest which will contain the packet id of the UNSUBSCRIBE packet being acknowledged. Promise is resolved when an UNSUBACK is received from the server or is rejected when an exception occurs.
Forces all written events to be buffered in memory. The buffered data will be flushed when uncork is called.
Flushes all data buffered since cork was called.
NOTE: It is HIGHLY recommended that uncorking should always be done via
process.nextTick
, not during the EventEmitter.on()
call.
Synchronously calls each of the listeners registered for the event key supplied in registration order. If the BufferedEventEmitter is currently corked, the event will be buffered until uncork is called.
The name of the event
Rest
...args: any[]Event payload
Static
CONNECTEmitted when the connection successfully establishes itself for the first time
Static
DISCONNECTEmitted when connection has disconnected successfully.
Static
ERROREmitted when an error occurs. The error will contain the error code and message.
Static
INTERRUPTEmitted when the connection is dropped unexpectedly. The error will contain the error code and message. The underlying mqtt implementation will attempt to reconnect.
Static
RESUMEEmitted when the connection reconnects (after an interrupt). Only triggers on connections after the initial one.
Static
MESSAGEEmitted when any MQTT publish message arrives.
Static
CONNECTION_Emitted on every successful connect and reconnect. Will contain a number with the connection reason code and a boolean indicating whether the connection resumed a session.
Static
CONNECTION_Emitted on an unsuccessful connect and reconnect. Will contain an error code indicating the reason for the unsuccessful connection.
Static
CLOSEDEmitted when the MQTT connection was disconnected and shutdown successfully.
Queries a small set of numerical statistics about the current state of the connection's operation queue
Queries a small set of numerical statistics about the current state of the connection's operation queue
use getOperationalStatistics instead
Generated using TypeDoc
MQTT client connection