mkdir foo
cd foo
npm install async-mqtt
npm install browserify
npm install tinyify
cd node_modules/async-mqtt/
npm install .
npx browserify index.js -p tinyify -s AsyncMqtt >browserAsyncMqtt.js
Show the compressed size to understand likley HTTP transfer size.
gzip <browserAsyncMqtt.js | wc -c
Be sure to only use this bundle with ws
or wss
URLs in the browser. Others will likey fail