You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to use MQTT.js as a browserify module you can either require it in your browserify bundles or build it as a stand alone module. The exported module is AMD/CommonJs compatible and it will add an object in the global space.
654
654
655
-
```javascript
656
-
npm install -g browserify // install browserify
657
-
cd node_modules/mqtt
658
-
npm install . // install dev dependencies
659
-
browserify mqtt.js-s mqtt >browserMqtt.js// require mqtt in your client-side app
655
+
```bash
656
+
mkdir tmpdir
657
+
cd tmpdir
658
+
npm install mqtt
659
+
npm install browserify
660
+
npm install tinyify
661
+
cd node_modules/mqtt/
662
+
npm install .
663
+
npx browserify mqtt.js -s mqtt >browserMqtt.js // use script tag
664
+
# show size for compressed browser transfer
665
+
gzip <browserMqtt.js | wc -c
660
666
```
661
667
668
+
**Be sure to only use this bundle with `ws` or `wss` URLs in the browser. Others URL types will likey fail**
0 commit comments