new MQTTClient(url, qosopt)
Creates a new MQTTClient
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
url | string | URL of the broker | |
qos | number | <optional> | Default quality of service |
Methods
asyncPublish(payload, topic, qos)
Publish the data in a background process. Returns immediately
Parameters:
Name | Type | Description |
---|---|---|
payload | object | |
topic | string | |
qos | number |
- Since
- 5.2.2
- See
- MQQTClient#publish
publish(payload, topic, qos, urlopt) → {boolean}
Publish something (bytes, string, js-object) under the given topic with optional quality of service (default is 0).
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
payload | object | payload to be published will be stringified and/or utf-8 encoded for transport | |
topic | string | topic to be published to | |
qos | number | quality of service (0,1,2) - default is 0 | |
url | string | <optional> | deprecated, pass the URL in the constructor |
- Since
- 5.2.0
Returns:
returns true if publish succesful, false otherwise
- Type:
- boolean