// the find
moscajs/ascoltatori
The pub/sub library for node backed by Redis, MongoDB, AMQP (RabbitMQ), ZeroMQ, MQTT (Mosquitto) or just plain node!
Ascoltatori is a Node.js pub/sub abstraction that lets you swap brokers (Redis, MongoDB, MQTT, AMQP, ZeroMQ, Kafka, filesystem) behind a single API. It was built by Matteo Collina, who also built MQTT.js and Mosca, so the MQTT and AMQP adapters in particular are well-considered. The target is anyone who wants to prototype with in-memory pub/sub and later swap to Redis or RabbitMQ without changing application code.
The wildcard subscription normalization across all backends is genuinely useful — translating MQTT-style `+`/`*` patterns into whatever the underlying broker understands is tedious code you don't want to write yourself. The shared test suite (`behave_like_an_ascoltatore.js`) runs the same spec against every adapter, which is a solid way to catch behavioral divergences. The debug flags per-transport (`DEBUG=ascoltatori:mqtt`) make diagnosing connection issues straightforward. The JSON wrapping layer is a decorator, not baked in, so binary payloads over Redis are still possible with `return_buffers`.
The repo has been dead since November 2019 and the npm package hasn't moved since 2017 — several of the peer dependencies (kafka-node, the older amqp package, zeromq bindings) have had breaking changes or security issues since then, so adopting this today means inheriting unmaintained transitive dependencies. The reliability section is honest that guarantees vary wildly by transport but doesn't tell you what those guarantees actually are for each one, which matters when you're choosing a backend for anything important. The callback-only API hasn't been updated to Promises or async/await, which is friction in any modern Node codebase. There's no reconnection strategy documented — what happens when the Redis connection drops mid-session is left to the underlying client.