Skip to content

Commit 185307e

Browse files
author
Yoseph Maguire
authored
Merge pull request mqttjs#1224 from cameronelliott/master
66% smaller browserify output. cut dependencies. ws/wss warning for newbies
2 parents c8cebbf + 8291aec commit 185307e

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

README.md

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -652,13 +652,21 @@ const client = connect('alis://test.mosquitto.org');
652652

653653
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.
654654

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
660666
```
661667

668+
**Be sure to only use this bundle with `ws` or `wss` URLs in the browser. Others URL types will likey fail**
669+
662670
<a name="webpack"></a>
663671
### Webpack
664672

0 commit comments

Comments
 (0)