mqtt 4.3.6 → 5.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -12
- package/dist/mqtt.js +18331 -11588
- package/dist/mqtt.min.js +12 -1
- package/lib/client.js +20 -8
- package/lib/connect/index.js +6 -2
- package/lib/connect/ws.js +2 -2
- package/lib/is-browser.js +11 -0
- package/package.json +46 -13
- package/types/lib/client-options.d.ts +5 -1
- package/types/lib/client.d.ts +2 -2
package/README.md
CHANGED
|
@@ -6,10 +6,6 @@
|
|
|
6
6
|
MQTT.js is a client library for the [MQTT](http://mqtt.org/) protocol, written
|
|
7
7
|
in JavaScript for node.js and the browser.
|
|
8
8
|
|
|
9
|
-
| :boom: MQTT.js vNext |
|
|
10
|
-
|:---------------------------|
|
|
11
|
-
| Want to contribute to the next generation of **MQTT.js**? Join the discussion [here](https://github.com/mqttjs/MQTT.js/discussions/1324). |
|
|
12
|
-
|
|
13
9
|
## Table of Contents
|
|
14
10
|
* [__MQTT.js vNext__](#vnext)
|
|
15
11
|
* [Upgrade notes](#notes)
|
|
@@ -31,8 +27,8 @@ MQTT.js is an OPEN Open Source Project, see the [Contributing](#contributing) se
|
|
|
31
27
|
Guide](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard)
|
|
32
28
|
|
|
33
29
|
<a name="vnext"></a>
|
|
34
|
-
##
|
|
35
|
-
There
|
|
30
|
+
## Next major version of MQTT.js
|
|
31
|
+
There is work being done on the next generation of MQTT.js (vNext). We invite the community to provide their contributions [this repository](https://github.com/mqttjs/mqttjs-v5)
|
|
36
32
|
|
|
37
33
|
<a name="notes"></a>
|
|
38
34
|
## Important notes for existing users
|
|
@@ -207,7 +203,7 @@ Example (update clientId & username on each reconnect):
|
|
|
207
203
|
client.options.username = `token=${this.get_current_auth_token()}`;
|
|
208
204
|
client.options.clientId = `${this.get_updated_clientId()}`;
|
|
209
205
|
|
|
210
|
-
return `${this.get_signed_cloud_url(url)`;
|
|
206
|
+
return `${this.get_signed_cloud_url(url)}`;
|
|
211
207
|
}
|
|
212
208
|
|
|
213
209
|
const connection = await mqtt.connectAsync(<wss url>, {
|
|
@@ -628,6 +624,8 @@ In-memory implementation of the message store.
|
|
|
628
624
|
|
|
629
625
|
Other implementations of `mqtt.Store`:
|
|
630
626
|
|
|
627
|
+
* [mqtt-jsonl-store](https://github.com/robertsLando/mqtt-jsonl-store) which uses
|
|
628
|
+
[jsonl-db](https://github.com/AlCalzone/jsonl-db) to store inflight data, it works only on Node.
|
|
631
629
|
* [mqtt-level-store](http://npm.im/mqtt-level-store) which uses
|
|
632
630
|
[Level-browserify](http://npm.im/level-browserify) to store the inflight
|
|
633
631
|
data, making it usable both in Node and the Browser.
|
|
@@ -789,13 +787,16 @@ About data consumption, obviously, QoS 2 > QoS 1 > QoS 0, if that's a concern to
|
|
|
789
787
|
This repo bundles TypeScript definition files for use in TypeScript projects and to support tools that can read `.d.ts` files.
|
|
790
788
|
|
|
791
789
|
### Pre-requisites
|
|
792
|
-
Before you can begin using these TypeScript definitions with your project, you need to make sure your project meets
|
|
790
|
+
Before you can begin using these TypeScript definitions with your project, you need to make sure your project meets these requirements:
|
|
793
791
|
* TypeScript >= 2.1
|
|
794
792
|
* Set tsconfig.json: `{"compilerOptions" : {"moduleResolution" : "node"}, ...}`
|
|
795
|
-
* Includes the TypeScript definitions for
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
793
|
+
* Includes the TypeScript definitions for Node and [ws](https://www.npmjs.com/package/ws). These types are used as
|
|
794
|
+
parameters to some of the MQTT client's APIs and if you don't install them they get treated as `any`, which means you lose type
|
|
795
|
+
safety.
|
|
796
|
+
Use npm to install them by typing the following into a terminal window:
|
|
797
|
+
`npm install --save-dev @types/node @types/ws`
|
|
798
|
+
|
|
799
|
+
### TypeScript example
|
|
799
800
|
```
|
|
800
801
|
import * as mqtt from "mqtt"
|
|
801
802
|
let client : mqtt.MqttClient = mqtt.connect('mqtt://test.mosquitto.org')
|