moscajs / mosca

MQTT broker as a module
mosca.io
3.2k stars 508 forks source link

Mosquitto and mosca: differences? #576

Closed rokka-n closed 7 years ago

rokka-n commented 7 years ago

Hi,

Are there any advantages of implementation for the broken in node? I'm pondering about performance and architectural differences between mosca and mosquitto.

Thanks!

mcollina commented 7 years ago

Mosquitto is written in C++. Mosca is written on top of Node.js. Mosquitto uses less resources, but Mosca can scale on multiple hosts.

a244096658 commented 7 years ago

I include Mosquitto in Mosca. But the pub/sub messaging still works fine even without adding Mosquitto. So what is the reason or benefit to use Mosquitto as a backend for Mosca? And how can I know that Mosca is using Mosquitto as a service?

My code is here:

var pubsubsettings = { type: 'mqtt', json: false, mqtt: require('mqtt'), host: '127.0.0.1', port: 1883 }; var moscaSettings = { port: 1884, //mosca (mqtt) port backend: pubsubsettings, //pubsubsettings is the object we created above }; var server = new mosca.Server(moscaSettings); server.on('ready', setup);

mcollina commented 7 years ago

To know if you are using Mosquitto as a service, check if Mosquitto is receiving your messages. You do not need to do this to use Mosca.