Description
`mqtt.Client#publish(topic, message, [options], [callback])
Publish a message to a topic
topic is the topic to publish to, String
message is the message to publish, Buffer or String
options is the options to publish with, including:
qos QoS level, Number, default 0
retain retain flag, Boolean, default false
dup mark as duplicate flag, Boolean, default false
properties: MQTT 5.0 properties object
payloadFormatIndicator: Payload is UTF-8 Encoded Character Data or not boolean,
messageExpiryInterval: the lifetime of the Application Message in seconds number,
topicAlias: value that is used to identify the Topic instead of using the Topic Name number,
responseTopic: String which is used as the Topic Name for a response message string,
correlationData: used by the sender of the Request Message to identify which request the Response Message is for when it is received binary,
userProperties: The User Property is allowed to appear multiple times to represent multiple name, value pairs object,
subscriptionIdentifier: representing the identifier of the subscription number,
contentType: String describing the content of the Application Message string
cbStorePut - function (), fired when message is put into outgoingStore if QoS is 1 or 2.
callback - function (err), fired when the QoS handling completes, or at the next tick if QoS 0. An error occurs if client is disconnecting.`
In fact there is no definition for 'properties' in source code
`export interface IClientPublishOptions {
/**
- the QoS
/
qos: QoS
/* - the retain flag
/
retain?: boolean
/* - whether or not mark a message as duplicate
/
dup?: boolean
/* - callback called when message is put into
outgoingStore
*/
cbStorePut?: StorePutCallback
}`