mqtt 5.0.0-beta.3 → 5.0.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.
Files changed (127) hide show
  1. package/README.md +43 -4
  2. package/build/package.json +162 -0
  3. package/build/src/bin/mqtt.d.ts +2 -0
  4. package/build/src/bin/mqtt.js +27 -0
  5. package/build/src/bin/mqtt.js.map +1 -0
  6. package/build/src/bin/pub.d.ts +2 -0
  7. package/build/src/bin/pub.js +146 -0
  8. package/build/src/bin/pub.js.map +1 -0
  9. package/build/src/bin/sub.d.ts +2 -0
  10. package/build/src/bin/sub.js +121 -0
  11. package/build/src/bin/sub.js.map +1 -0
  12. package/build/src/lib/TypedEmitter.d.ts +11 -0
  13. package/build/src/lib/TypedEmitter.js +13 -0
  14. package/build/src/lib/TypedEmitter.js.map +1 -0
  15. package/build/src/lib/client.d.ts +220 -0
  16. package/build/src/lib/client.js +1204 -0
  17. package/build/src/lib/client.js.map +1 -0
  18. package/build/src/lib/connect/ali.d.ts +3 -0
  19. package/build/src/lib/connect/ali.js +113 -0
  20. package/build/src/lib/connect/ali.js.map +1 -0
  21. package/build/src/lib/connect/index.d.ts +9 -0
  22. package/build/src/lib/connect/index.js +169 -0
  23. package/build/src/lib/connect/index.js.map +1 -0
  24. package/build/src/lib/connect/tcp.d.ts +3 -0
  25. package/build/src/lib/connect/tcp.js +18 -0
  26. package/build/src/lib/connect/tcp.js.map +1 -0
  27. package/build/src/lib/connect/tls.d.ts +3 -0
  28. package/build/src/lib/connect/tls.js +38 -0
  29. package/build/src/lib/connect/tls.js.map +1 -0
  30. package/build/src/lib/connect/ws.d.ts +3 -0
  31. package/build/src/lib/connect/ws.js +212 -0
  32. package/build/src/lib/connect/ws.js.map +1 -0
  33. package/build/src/lib/connect/wx.d.ts +3 -0
  34. package/build/src/lib/connect/wx.js +117 -0
  35. package/build/src/lib/connect/wx.js.map +1 -0
  36. package/build/src/lib/default-message-id-provider.d.ts +16 -0
  37. package/build/src/lib/default-message-id-provider.js +24 -0
  38. package/build/src/lib/default-message-id-provider.js.map +1 -0
  39. package/build/src/lib/handlers/ack.d.ts +48 -0
  40. package/build/src/lib/handlers/ack.js +129 -0
  41. package/build/src/lib/handlers/ack.js.map +1 -0
  42. package/build/src/lib/handlers/auth.d.ts +3 -0
  43. package/build/src/lib/handlers/auth.js +30 -0
  44. package/build/src/lib/handlers/auth.js.map +1 -0
  45. package/build/src/lib/handlers/connack.d.ts +3 -0
  46. package/build/src/lib/handlers/connack.js +48 -0
  47. package/build/src/lib/handlers/connack.js.map +1 -0
  48. package/build/src/lib/handlers/index.d.ts +3 -0
  49. package/build/src/lib/handlers/index.js +64 -0
  50. package/build/src/lib/handlers/index.js.map +1 -0
  51. package/build/src/lib/handlers/publish.d.ts +3 -0
  52. package/build/src/lib/handlers/publish.js +106 -0
  53. package/build/src/lib/handlers/publish.js.map +1 -0
  54. package/build/src/lib/handlers/pubrel.d.ts +3 -0
  55. package/build/src/lib/handlers/pubrel.js +25 -0
  56. package/build/src/lib/handlers/pubrel.js.map +1 -0
  57. package/build/src/lib/is-browser.d.ts +2 -0
  58. package/build/src/lib/is-browser.js +8 -0
  59. package/build/src/lib/is-browser.js.map +1 -0
  60. package/build/src/lib/shared.d.ts +18 -0
  61. package/build/src/lib/shared.js +35 -0
  62. package/build/src/lib/shared.js.map +1 -0
  63. package/build/src/lib/store.d.ts +24 -0
  64. package/build/src/lib/store.js +80 -0
  65. package/build/src/lib/store.js.map +1 -0
  66. package/build/src/lib/topic-alias-recv.d.ts +9 -0
  67. package/build/src/lib/topic-alias-recv.js +24 -0
  68. package/build/src/lib/topic-alias-recv.js.map +1 -0
  69. package/build/src/lib/topic-alias-send.d.ts +13 -0
  70. package/build/src/lib/topic-alias-send.js +56 -0
  71. package/build/src/lib/topic-alias-send.js.map +1 -0
  72. package/build/src/lib/unique-message-id-provider.d.ts +11 -0
  73. package/build/src/lib/unique-message-id-provider.js +26 -0
  74. package/build/src/lib/unique-message-id-provider.js.map +1 -0
  75. package/build/src/lib/validations.d.ts +2 -0
  76. package/build/src/lib/validations.js +32 -0
  77. package/build/src/lib/validations.js.map +1 -0
  78. package/build/src/mqtt.d.ts +10 -0
  79. package/build/src/mqtt.js +49 -0
  80. package/build/src/mqtt.js.map +1 -0
  81. package/build/tsconfig.build.tsbuildinfo +1 -0
  82. package/dist/mqtt.js +2726 -3493
  83. package/dist/mqtt.min.js +4 -4
  84. package/doc/subscribe.txt +1 -1
  85. package/package.json +49 -29
  86. package/{bin/mqtt.js → src/bin/mqtt.ts} +11 -6
  87. package/src/bin/pub.ts +171 -0
  88. package/src/bin/sub.ts +146 -0
  89. package/src/lib/TypedEmitter.ts +45 -0
  90. package/{lib/client.js → src/lib/client.ts} +895 -252
  91. package/{lib/connect/ali.js → src/lib/connect/ali.ts} +13 -11
  92. package/src/lib/connect/index.ts +241 -0
  93. package/{lib/connect/tcp.js → src/lib/connect/tcp.ts} +8 -4
  94. package/{lib/connect/tls.js → src/lib/connect/tls.ts} +10 -8
  95. package/{lib/connect/ws.js → src/lib/connect/ws.ts} +52 -36
  96. package/{lib/connect/wx.js → src/lib/connect/wx.ts} +18 -9
  97. package/src/lib/default-message-id-provider.ts +99 -0
  98. package/{lib/handlers/ack.js → src/lib/handlers/ack.ts} +17 -19
  99. package/src/lib/handlers/auth.ts +44 -0
  100. package/{lib/handlers/connack.js → src/lib/handlers/connack.ts} +15 -11
  101. package/{lib/handlers/index.js → src/lib/handlers/index.ts} +8 -7
  102. package/{lib/handlers/publish.js → src/lib/handlers/publish.ts} +73 -57
  103. package/src/lib/handlers/pubrel.ts +27 -0
  104. package/{lib/is-browser.js → src/lib/is-browser.ts} +5 -4
  105. package/src/lib/shared.ts +73 -0
  106. package/{lib/store.js → src/lib/store.ts} +61 -16
  107. package/{lib/topic-alias-recv.js → src/lib/topic-alias-recv.ts} +10 -6
  108. package/{lib/topic-alias-send.js → src/lib/topic-alias-send.ts} +19 -11
  109. package/{lib/unique-message-id-provider.js → src/lib/unique-message-id-provider.ts} +10 -7
  110. package/{lib/validations.js → src/lib/validations.ts} +2 -6
  111. package/src/mqtt.ts +26 -0
  112. package/bin/pub.js +0 -159
  113. package/bin/sub.js +0 -141
  114. package/lib/connect/index.js +0 -175
  115. package/lib/default-message-id-provider.js +0 -63
  116. package/lib/handlers/auth.js +0 -34
  117. package/lib/handlers/pubrel.js +0 -24
  118. package/mqtt.js +0 -21
  119. package/types/index.d.ts +0 -30
  120. package/types/lib/client-options.d.ts +0 -224
  121. package/types/lib/client.d.ts +0 -273
  122. package/types/lib/connect/index.d.ts +0 -19
  123. package/types/lib/default-message-id-provider.d.ts +0 -49
  124. package/types/lib/message-id-provider.d.ts +0 -40
  125. package/types/lib/store-options.d.ts +0 -6
  126. package/types/lib/store.d.ts +0 -46
  127. package/types/lib/unique-message-id-provider.d.ts +0 -48
@@ -1,175 +0,0 @@
1
- const url = require('url')
2
- const MqttClient = require('../client')
3
- const Store = require('../store')
4
- const DefaultMessageIdProvider = require('../default-message-id-provider')
5
- const UniqueMessageIdProvider = require('../unique-message-id-provider')
6
- const { IS_BROWSER } = require('../is-browser')
7
- const debug = require('debug')('mqttjs')
8
-
9
- const protocols = {}
10
-
11
- if (!IS_BROWSER) {
12
- protocols.mqtt = require('./tcp')
13
- protocols.tcp = require('./tcp')
14
- protocols.ssl = require('./tls')
15
- protocols.tls = require('./tls')
16
- protocols.mqtts = require('./tls')
17
- } else {
18
- protocols.wx = require('./wx')
19
- protocols.wxs = require('./wx')
20
-
21
- protocols.ali = require('./ali')
22
- protocols.alis = require('./ali')
23
- }
24
-
25
- protocols.ws = require('./ws')
26
- protocols.wss = require('./ws')
27
-
28
- /**
29
- * Parse the auth attribute and merge username and password in the options object.
30
- *
31
- * @param {Object} [opts] option object
32
- */
33
- function parseAuthOptions(opts) {
34
- let matches
35
- if (opts.auth) {
36
- matches = opts.auth.match(/^(.+):(.+)$/)
37
- if (matches) {
38
- opts.username = matches[1]
39
- opts.password = matches[2]
40
- } else {
41
- opts.username = opts.auth
42
- }
43
- }
44
- }
45
-
46
- /**
47
- * connect - connect to an MQTT broker.
48
- *
49
- * @param {String} [brokerUrl] - url of the broker, optional
50
- * @param {Object} opts - see MqttClient#constructor
51
- */
52
- function connect(brokerUrl, opts) {
53
- debug('connecting to an MQTT broker...')
54
- if (typeof brokerUrl === 'object' && !opts) {
55
- opts = brokerUrl
56
- brokerUrl = null
57
- }
58
-
59
- opts = opts || {}
60
-
61
- if (brokerUrl) {
62
- // eslint-disable-next-line
63
- const parsed = url.parse(brokerUrl, true)
64
- if (parsed.port != null) {
65
- parsed.port = Number(parsed.port)
66
- }
67
-
68
- opts = { ...parsed, ...opts }
69
-
70
- if (opts.protocol === null) {
71
- throw new Error('Missing protocol')
72
- }
73
-
74
- opts.protocol = opts.protocol.replace(/:$/, '')
75
- }
76
-
77
- // merge in the auth options if supplied
78
- parseAuthOptions(opts)
79
-
80
- // support clientId passed in the query string of the url
81
- if (opts.query && typeof opts.query.clientId === 'string') {
82
- opts.clientId = opts.query.clientId
83
- }
84
-
85
- if (opts.cert && opts.key) {
86
- if (opts.protocol) {
87
- if (['mqtts', 'wss', 'wxs', 'alis'].indexOf(opts.protocol) === -1) {
88
- switch (opts.protocol) {
89
- case 'mqtt':
90
- opts.protocol = 'mqtts'
91
- break
92
- case 'ws':
93
- opts.protocol = 'wss'
94
- break
95
- case 'wx':
96
- opts.protocol = 'wxs'
97
- break
98
- case 'ali':
99
- opts.protocol = 'alis'
100
- break
101
- default:
102
- throw new Error(
103
- `Unknown protocol for secure connection: "${opts.protocol}"!`,
104
- )
105
- }
106
- }
107
- } else {
108
- // A cert and key was provided, however no protocol was specified, so we will throw an error.
109
- throw new Error('Missing secure protocol key')
110
- }
111
- }
112
-
113
- if (!protocols[opts.protocol]) {
114
- const isSecure = ['mqtts', 'wss'].indexOf(opts.protocol) !== -1
115
- opts.protocol = [
116
- 'mqtt',
117
- 'mqtts',
118
- 'ws',
119
- 'wss',
120
- 'wx',
121
- 'wxs',
122
- 'ali',
123
- 'alis',
124
- ].filter((key, index) => {
125
- if (isSecure && index % 2 === 0) {
126
- // Skip insecure protocols when requesting a secure one.
127
- return false
128
- }
129
- return typeof protocols[key] === 'function'
130
- })[0]
131
- }
132
-
133
- if (opts.clean === false && !opts.clientId) {
134
- throw new Error('Missing clientId for unclean clients')
135
- }
136
-
137
- if (opts.protocol) {
138
- opts.defaultProtocol = opts.protocol
139
- }
140
-
141
- function wrapper(client) {
142
- if (opts.servers) {
143
- if (
144
- !client._reconnectCount ||
145
- client._reconnectCount === opts.servers.length
146
- ) {
147
- client._reconnectCount = 0
148
- }
149
-
150
- opts.host = opts.servers[client._reconnectCount].host
151
- opts.port = opts.servers[client._reconnectCount].port
152
- opts.protocol = !opts.servers[client._reconnectCount].protocol
153
- ? opts.defaultProtocol
154
- : opts.servers[client._reconnectCount].protocol
155
- opts.hostname = opts.host
156
-
157
- client._reconnectCount++
158
- }
159
-
160
- debug('calling streambuilder for', opts.protocol)
161
- return protocols[opts.protocol](client, opts)
162
- }
163
- const client = new MqttClient(wrapper, opts)
164
- client.on('error', () => {
165
- /* Automatically set up client error handling */
166
- })
167
- return client
168
- }
169
-
170
- module.exports = connect
171
- module.exports.connect = connect
172
- module.exports.MqttClient = MqttClient
173
- module.exports.Store = Store
174
- module.exports.DefaultMessageIdProvider = DefaultMessageIdProvider
175
- module.exports.UniqueMessageIdProvider = UniqueMessageIdProvider
@@ -1,63 +0,0 @@
1
- /**
2
- * DefaultMessageAllocator constructor
3
- * @constructor
4
- */
5
- class DefaultMessageIdProvider {
6
- constructor() {
7
- /**
8
- * MessageIDs starting with 1
9
- * ensure that nextId is min. 1, see https://github.com/mqttjs/MQTT.js/issues/810
10
- */
11
- this.nextId = Math.max(1, Math.floor(Math.random() * 65535))
12
- }
13
-
14
- /**
15
- * allocate
16
- *
17
- * Get the next messageId.
18
- * @return unsigned int
19
- */
20
- allocate() {
21
- // id becomes current state of this.nextId and increments afterwards
22
- const id = this.nextId++
23
- // Ensure 16 bit unsigned int (max 65535, nextId got one higher)
24
- if (this.nextId === 65536) {
25
- this.nextId = 1
26
- }
27
- return id
28
- }
29
-
30
- /**
31
- * getLastAllocated
32
- * Get the last allocated messageId.
33
- * @return unsigned int
34
- */
35
- getLastAllocated() {
36
- return this.nextId === 1 ? 65535 : this.nextId - 1
37
- }
38
-
39
- /**
40
- * register
41
- * Register messageId. If success return true, otherwise return false.
42
- * @param { unsigned int } - messageId to register,
43
- * @return boolean
44
- */
45
- register(messageId) {
46
- return true
47
- }
48
-
49
- /**
50
- * deallocate
51
- * Deallocate messageId.
52
- * @param { unsigned int } - messageId to deallocate,
53
- */
54
- deallocate(messageId) {}
55
-
56
- /**
57
- * clear
58
- * Deallocate all messageIds.
59
- */
60
- clear() {}
61
- }
62
-
63
- module.exports = DefaultMessageIdProvider
@@ -1,34 +0,0 @@
1
- const { errors } = require('./ack')
2
-
3
- function handleAuth(client, packet) {
4
- const { options } = client
5
- const version = options.protocolVersion
6
- const rc = version === 5 ? packet.reasonCode : packet.returnCode
7
-
8
- if (version !== 5) {
9
- const err = new Error(
10
- `Protocol error: Auth packets are only supported in MQTT 5. Your version:${version}`,
11
- )
12
- err.code = rc
13
- client.emit('error', err)
14
- return
15
- }
16
-
17
- client.handleAuth(packet, (err, packet2) => {
18
- if (err) {
19
- client.emit('error', err)
20
- return
21
- }
22
-
23
- if (rc === 24) {
24
- client.reconnecting = false
25
- client._sendPacket(packet2)
26
- } else {
27
- const error = new Error(`Connection refused: ${errors[rc]}`)
28
- err.code = rc
29
- client.emit('error', error)
30
- }
31
- })
32
- }
33
-
34
- module.exports = handleAuth
@@ -1,24 +0,0 @@
1
- function handlePubrel(client, packet, done) {
2
- client.log('handling pubrel packet')
3
- const callback = typeof done !== 'undefined' ? done : client.noop
4
- const { messageId } = packet
5
-
6
- const comp = { cmd: 'pubcomp', messageId }
7
-
8
- client.incomingStore.get(packet, (err, pub) => {
9
- if (!err) {
10
- client.emit('message', pub.topic, pub.payload, pub)
11
- client.handleMessage(pub, (err2) => {
12
- if (err2) {
13
- return callback(err2)
14
- }
15
- client.incomingStore.del(pub, client.noop)
16
- client._sendPacket(comp, callback)
17
- })
18
- } else {
19
- client._sendPacket(comp, callback)
20
- }
21
- })
22
- }
23
-
24
- module.exports = handlePubrel
package/mqtt.js DELETED
@@ -1,21 +0,0 @@
1
- /*
2
- * Copyright (c) 2015-2015 MQTT.js contributors.
3
- * Copyright (c) 2011-2014 Adam Rudd.
4
- *
5
- * See LICENSE for more information
6
- */
7
-
8
- const MqttClient = require('./lib/client')
9
- const connect = require('./lib/connect')
10
- const Store = require('./lib/store')
11
- const DefaultMessageIdProvider = require('./lib/default-message-id-provider')
12
- const UniqueMessageIdProvider = require('./lib/unique-message-id-provider')
13
-
14
- module.exports.connect = connect
15
-
16
- // Expose MqttClient
17
- module.exports.MqttClient = MqttClient
18
- module.exports.Client = MqttClient
19
- module.exports.Store = Store
20
- module.exports.DefaultMessageIdProvider = DefaultMessageIdProvider
21
- module.exports.UniqueMessageIdProvider = UniqueMessageIdProvider
package/types/index.d.ts DELETED
@@ -1,30 +0,0 @@
1
- export * from './lib/client'
2
- export * from './lib/connect'
3
- export * from './lib/store'
4
- export * from './lib/client-options'
5
- import { MqttClient } from './lib/client'
6
- export { MqttClient as Client }
7
- export {
8
- QoS,
9
- PacketCmd,
10
- IPacket,
11
- IConnectPacket,
12
- IPublishPacket,
13
- IConnackPacket,
14
- ISubscription,
15
- ISubscribePacket,
16
- ISubackPacket,
17
- IUnsubscribePacket,
18
- IUnsubackPacket,
19
- IPubackPacket,
20
- IPubcompPacket,
21
- IPubrelPacket,
22
- IPubrecPacket,
23
- IPingreqPacket,
24
- IPingrespPacket,
25
- IDisconnectPacket,
26
- Packet,
27
- UserProperties
28
- } from 'mqtt-packet'
29
- export { IMessageIdProvider } from './lib/message-id-provider'
30
- export { UniqueMessageIdProvider } from './lib/unique-message-id-provider'
@@ -1,224 +0,0 @@
1
- import { MqttClient } from './client'
2
- import { Store } from './store'
3
- import { ClientOptions } from 'ws'
4
- import { ClientRequestArgs } from 'http'
5
- import { QoS, UserProperties } from 'mqtt-packet'
6
- import { IMessageIdProvider } from './message-id-provider'
7
-
8
- export declare type StorePutCallback = () => void
9
-
10
- export interface IClientOptions extends ISecureClientOptions {
11
- port?: number // port is made into a number subsequently
12
- host?: string // host does NOT include port
13
- hostname?: string
14
- path?: string
15
- protocol?: 'wss' | 'ws' | 'mqtt' | 'mqtts' | 'tcp' | 'ssl' | 'wx' | 'wxs'
16
-
17
- wsOptions?: ClientOptions | ClientRequestArgs
18
- /**
19
- * 10 seconds, set to 0 to disable
20
- */
21
- keepalive?: number
22
- /**
23
- * 'mqttjs_' + Math.random().toString(16).substr(2, 8)
24
- */
25
- clientId?: string
26
- /**
27
- * 'MQTT'
28
- */
29
- protocolId?: string
30
- /**
31
- * 4
32
- */
33
- protocolVersion?: number
34
- /**
35
- * true, set to false to receive QoS 1 and 2 messages while offline
36
- */
37
- clean?: boolean
38
- /**
39
- * 1000 milliseconds, interval between two reconnections
40
- */
41
- reconnectPeriod?: number
42
- /**
43
- * 30 * 1000 milliseconds, time to wait before a CONNACK is received
44
- */
45
- connectTimeout?: number
46
- /**
47
- * the username required by your broker, if any
48
- */
49
- username?: string
50
- /**
51
- * the password required by your broker, if any
52
- */
53
- password?: Buffer | string
54
- /**
55
- * a Store for the incoming packets
56
- */
57
- incomingStore?: Store
58
- /**
59
- * a Store for the outgoing packets
60
- */
61
- outgoingStore?: Store
62
- queueQoSZero?: boolean
63
-
64
- log?: (...args: any[]) => void
65
-
66
- autoUseTopicAlias?: boolean
67
- autoAssignTopicAlias?: boolean
68
-
69
- reschedulePings?: boolean
70
- servers?: Array<{
71
- host: string
72
- port: number
73
- protocol?: 'wss' | 'ws' | 'mqtt' | 'mqtts' | 'tcp' | 'ssl' | 'wx' | 'wxs'
74
- }>
75
- /**
76
- * true, set to false to disable re-subscribe functionality
77
- */
78
- resubscribe?: boolean
79
- /**
80
- * a message that will sent by the broker automatically when the client disconnect badly.
81
- */
82
- will?: {
83
- /**
84
- * the topic to publish
85
- */
86
- topic: string
87
- /**
88
- * the message to publish
89
- */
90
- payload: Buffer | string
91
- /**
92
- * the QoS
93
- */
94
- qos: QoS
95
- /**
96
- * the retain flag
97
- */
98
- retain: boolean,
99
- /*
100
- * properies object of will
101
- * */
102
- properties?: {
103
- willDelayInterval?: number,
104
- payloadFormatIndicator?: boolean,
105
- messageExpiryInterval?: number,
106
- contentType?: string,
107
- responseTopic?: string,
108
- correlationData?: Buffer,
109
- userProperties?: UserProperties
110
- },
111
-
112
- authPacket?: any
113
-
114
- /** Prevent to call `connect` in constructor */
115
- manualConnect?: boolean
116
- }
117
- transformWsUrl?: (url: string, options: IClientOptions, client: MqttClient) => string,
118
- properties?: {
119
- sessionExpiryInterval?: number,
120
- receiveMaximum?: number,
121
- maximumPacketSize?: number,
122
- topicAliasMaximum?: number,
123
- requestResponseInformation?: boolean,
124
- requestProblemInformation?: boolean,
125
- userProperties?: UserProperties,
126
- authenticationMethod?: string,
127
- authenticationData?: Buffer
128
- },
129
- messageIdProvider?: IMessageIdProvider
130
- }
131
- export interface ISecureClientOptions {
132
- /**
133
- * optional private keys in PEM format
134
- */
135
- key?: string | string[] | Buffer | Buffer[] | Object[]
136
- /**
137
- * optional cert chains in PEM format
138
- */
139
- cert?: string | string[] | Buffer | Buffer[]
140
- /**
141
- * Optionally override the trusted CA certificates in PEM format
142
- */
143
- ca?: string | string[] | Buffer | Buffer[]
144
- rejectUnauthorized?: boolean
145
- /**
146
- * optional alpn's
147
- */
148
- ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array
149
- }
150
- export interface IClientPublishOptions {
151
- /**
152
- * the QoS
153
- */
154
- qos?: QoS
155
- /**
156
- * the retain flag
157
- */
158
- retain?: boolean
159
- /**
160
- * whether or not mark a message as duplicate
161
- */
162
- dup?: boolean
163
- /*
164
- * MQTT 5.0 properties object
165
- */
166
- properties?: {
167
- payloadFormatIndicator?: boolean,
168
- messageExpiryInterval?: number,
169
- topicAlias?: number,
170
- responseTopic?: string,
171
- correlationData?: Buffer,
172
- userProperties?: UserProperties,
173
- subscriptionIdentifier?: number,
174
- contentType?: string
175
- }
176
- /**
177
- * callback called when message is put into `outgoingStore`
178
- */
179
- cbStorePut?: StorePutCallback
180
- }
181
- export interface IClientSubscribeOptions {
182
- /**
183
- * the QoS
184
- */
185
- qos: QoS,
186
- /*
187
- * no local flag
188
- * */
189
- nl?: boolean,
190
- /*
191
- * Retain As Published flag
192
- * */
193
- rap?: boolean,
194
- /*
195
- * Retain Handling option
196
- * */
197
- rh?: number,
198
- /*
199
- * MQTT 5.0 properies object of subscribe
200
- * */
201
- properties?: {
202
- subscriptionIdentifier?: number,
203
- userProperties?: UserProperties
204
- }
205
- }
206
- export interface IClientSubscribeProperties {
207
- /*
208
- * MQTT 5.0 properies object of subscribe
209
- * */
210
- properties?: {
211
- subscriptionIdentifier?: number,
212
- userProperties?: UserProperties
213
- }
214
- }
215
- export interface IClientReconnectOptions {
216
- /**
217
- * a Store for the incoming packets
218
- */
219
- incomingStore?: Store
220
- /**
221
- * a Store for the outgoing packets
222
- */
223
- outgoingStore?: Store
224
- }