Node JS application using MQTT and Socket.IO both. This repository contains single-threaded vs multi threaded node application
- Download the files and put it in a folder.
- Run
npm install
and add all dependencies. - Now first try single threaded.js by running
node single-threaded.js
- Then try running
node multi-threaded.js
Run below URLs in your browser and check the logs in your terminal for both point 3 and 4.
- http://localhost:5000/socket_mqtt_notification/111
- http://localhost:5000/socket_mqtt_notification/222
- http://localhost:5000/socket_mqtt_notification/333
For more information on clustering and sockets you can go through this Medium Article :- https://medium.com/@jadejayashraj/node-js-cluster-with-mqtt-socket-io-redis-and-sticky-sessions-d5be72ef65f0