// the find
moscajs/mosca
MQTT broker as a module
Mosca is an embeddable Node.js MQTT broker supporting MQTT 3.1/3.1.1 with pluggable backends (MongoDB, Redis, LevelDB, memory). It's explicitly unmaintained — the README tells you to use Aedes instead. Don't adopt this for anything new.
- Embedding story is genuinely good: drop an MQTT broker into any Node.js process with a few lines, useful for testing or lightweight IoT gateways
- Multiple persistence backends for QoS 1 offline queuing gives real flexibility — memory for dev, Redis or Mongo for prod
- WebSocket support alongside raw TCP means browser clients work without extra infrastructure
- Test suite covers persistence adapters with abstract shared specs — the pattern is solid even if the code is old
- Abandoned since 2020 with no QoS 2 support — any IoT use case requiring exactly-once delivery is a dead end here
- Targets Node v4/v6 era; the async model predates modern async/await patterns, making the callback-heavy codebase painful to extend
- The successor (Aedes) exists, is maintained, and is a direct replacement — there is no reason to pick Mosca over it
- MongoDB persistence stores retained messages in a shared pub/sub collection, which becomes a performance problem at any meaningful message volume