Use Eclipse Paho JavaScript Client for MQTT in Node.js
git clone https://github.com/pmorjan/paho-node.git
cd paho-node
npm install
wget https://raw.githubusercontent.com/eclipse/paho.mqtt.javascript/v1.0.2/src/mqttws31.js
git apply mqttws31.js.patch
node example.js