new $k.MQTTClient(url, qos)
Creates a new MQTTClient
Name | Type | 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
Name | Type | Description |
---|---|---|
payload |
object | |
topic |
string | |
qos |
number |
- Since:
- 5.2.2
- See:
-
- MQQTClient#publish
publish(payload, topic, qos, url) : boolean
Publish something (bytes, string, js-object) under the given topic with optional quality of service (default is 0).
Name | Type | 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:
Type | Description |
---|---|
boolean | returns true if publish succesful, false otherwise |