Skip to content

Commit f5ab1b5

Browse files
authored
fix: buffer is not defined in browser (#1420)
1 parent fad8ad6 commit f5ab1b5

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

lib/connect/ali.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict'
22

3+
const { Buffer } = require('buffer')
34
const Transform = require('readable-stream').Transform
45
const duplexify = require('duplexify')
56

lib/connect/ws.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict'
22

3+
const { Buffer } = require('buffer')
34
const WS = require('ws')
45
const debug = require('debug')('mqttjs:ws')
56
const duplexify = require('duplexify')

lib/connect/wx.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict'
22

3+
const { Buffer } = require('buffer')
34
const Transform = require('readable-stream').Transform
45
const duplexify = require('duplexify')
56

types/lib/connect/index.d.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,19 @@
1-
import { IClientOptions, MqttClient } from "../client";
2-
/**
3-
* connect - connect to an MQTT broker.
4-
*
5-
* @param {String} brokerUrl - url of the broker
6-
*/
7-
declare function connect(brokerUrl: string): MqttClient;
1+
import { IClientOptions, MqttClient } from '../client'
82

93
/**
104
* connect - connect to an MQTT broker.
115
*
126
* @param {Object} opts - see MqttClient#constructor
137
*/
14-
declare function connect(opts: IClientOptions): MqttClient;
8+
declare function connect (opts: IClientOptions): MqttClient
159

1610
/**
1711
* connect - connect to an MQTT broker.
1812
*
1913
* @param {String} brokerUrl - url of the broker
2014
* @param {Object} opts - see MqttClient#constructor
2115
*/
22-
declare function connect(brokerUrl: string, opts: IClientOptions): MqttClient;
16+
declare function connect (brokerUrl: string, opts?: IClientOptions): MqttClient
2317

24-
export { connect };
25-
export { MqttClient };
18+
export { connect }
19+
export { MqttClient }

0 commit comments

Comments
 (0)