mqtt 4.2.8 → 4.3.3
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/CHANGELOG.md +63 -1
- package/CONTRIBUTING.md +27 -27
- package/LICENSE.md +15 -15
- package/README.md +843 -792
- package/bin/mqtt.js +27 -27
- package/bin/pub.js +146 -146
- package/bin/sub.js +123 -123
- package/dist/mqtt.js +14842 -4574
- package/dist/mqtt.min.js +1 -1
- package/doc/help.txt +8 -8
- package/doc/publish.txt +26 -26
- package/doc/subscribe.txt +26 -26
- package/lib/client.js +563 -260
- package/lib/connect/ali.js +128 -128
- package/lib/connect/index.js +165 -164
- package/lib/connect/tcp.js +20 -21
- package/lib/connect/tls.js +48 -45
- package/lib/connect/ws.js +256 -256
- package/lib/connect/wx.js +132 -134
- package/lib/default-message-id-provider.js +69 -0
- package/lib/store.js +128 -128
- package/lib/topic-alias-recv.js +47 -0
- package/lib/topic-alias-send.js +93 -0
- package/lib/unique-message-id-provider.js +65 -0
- package/lib/validations.js +52 -52
- package/mqtt.js +21 -17
- package/package.json +21 -8
- package/types/index.d.ts +30 -28
- package/types/lib/client-options.d.ts +204 -191
- package/types/lib/client.d.ts +261 -240
- package/types/lib/connect/index.d.ts +10 -10
- package/types/lib/default-message-id-provider.d.ts +49 -0
- package/types/lib/message-id-provider.d.ts +40 -0
- package/types/lib/store-options.d.ts +6 -6
- package/types/lib/store.d.ts +46 -46
- package/types/lib/unique-message-id-provider.d.ts +48 -0
package/types/lib/store.d.ts
CHANGED
|
@@ -1,46 +1,46 @@
|
|
|
1
|
-
import {
|
|
2
|
-
IStoreOptions
|
|
3
|
-
} from './store-options'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* In-memory implementation of the message store
|
|
7
|
-
* This can actually be saved into files.
|
|
8
|
-
*
|
|
9
|
-
*/
|
|
10
|
-
declare class Store {
|
|
11
|
-
/**
|
|
12
|
-
* Store constructor
|
|
13
|
-
*
|
|
14
|
-
* @param {Object} [options] - store options
|
|
15
|
-
*/
|
|
16
|
-
constructor (options: IStoreOptions)
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Adds a packet to the store, a packet is
|
|
20
|
-
* anything that has a messageId property.
|
|
21
|
-
*
|
|
22
|
-
*/
|
|
23
|
-
public put (packet: any, cb?: Function): this
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
* Creates a stream with all the packets in the store
|
|
27
|
-
*
|
|
28
|
-
*/
|
|
29
|
-
public createStream (): any
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* deletes a packet from the store.
|
|
33
|
-
*/
|
|
34
|
-
public del (packet: any, cb: Function): this
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* get a packet from the store.
|
|
38
|
-
*/
|
|
39
|
-
public get (packet: any, cb: Function): this
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Close the store
|
|
43
|
-
*/
|
|
44
|
-
public close (cb: Function): void
|
|
45
|
-
}
|
|
46
|
-
export { Store }
|
|
1
|
+
import {
|
|
2
|
+
IStoreOptions
|
|
3
|
+
} from './store-options'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* In-memory implementation of the message store
|
|
7
|
+
* This can actually be saved into files.
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
declare class Store {
|
|
11
|
+
/**
|
|
12
|
+
* Store constructor
|
|
13
|
+
*
|
|
14
|
+
* @param {Object} [options] - store options
|
|
15
|
+
*/
|
|
16
|
+
constructor (options: IStoreOptions)
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Adds a packet to the store, a packet is
|
|
20
|
+
* anything that has a messageId property.
|
|
21
|
+
*
|
|
22
|
+
*/
|
|
23
|
+
public put (packet: any, cb?: Function): this
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Creates a stream with all the packets in the store
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
public createStream (): any
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* deletes a packet from the store.
|
|
33
|
+
*/
|
|
34
|
+
public del (packet: any, cb: Function): this
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* get a packet from the store.
|
|
38
|
+
*/
|
|
39
|
+
public get (packet: any, cb: Function): this
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Close the store
|
|
43
|
+
*/
|
|
44
|
+
public close (cb: Function): void
|
|
45
|
+
}
|
|
46
|
+
export { Store }
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { IMessageIdProvider } from './message-id-provider'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* UniqueMessageIdProvider
|
|
5
|
+
*/
|
|
6
|
+
declare class UniqueMessageIdProvider implements IMessageIdProvider {
|
|
7
|
+
/**
|
|
8
|
+
* UniqueMessageIdProvider constructor.
|
|
9
|
+
* @constructor
|
|
10
|
+
*/
|
|
11
|
+
constructor ()
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Allocate the first vacant messageId. The messageId become occupied status.
|
|
15
|
+
* @return {Number} - The first vacant messageId. If all messageIds are occupied, return null.
|
|
16
|
+
*/
|
|
17
|
+
public allocate (): Number | null
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Get the last allocated messageId.
|
|
21
|
+
* @return {Number} - messageId.
|
|
22
|
+
*/
|
|
23
|
+
public getLastAllocated (): Number | null
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Register the messageId. The messageId become occupied status.
|
|
27
|
+
* If the messageId has already been occupied, then return false.
|
|
28
|
+
* @param {Number} num - The messageId to request use.
|
|
29
|
+
* @return {Boolean} - If `num` was not occupied, then return true, otherwise return false.
|
|
30
|
+
*/
|
|
31
|
+
public register (num: Number): Boolean
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Deallocate the messageId. The messageId become vacant status.
|
|
35
|
+
* @param {Number} num - The messageId to deallocate. The messageId must be occupied status.
|
|
36
|
+
* In other words, the messageId must be allocated by allocate() or
|
|
37
|
+
* occupied by register().
|
|
38
|
+
*/
|
|
39
|
+
public deallocate (num: Number): void
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Clear all occupied messageIds.
|
|
43
|
+
* The all messageIds are set to vacant status.
|
|
44
|
+
*/
|
|
45
|
+
public clear (): void
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export { UniqueMessageIdProvider }
|