Skip to content
eric edited this page Jul 20, 2026 · 4 revisions

tyo-mq

Distributed message pub/sub service built on socket.io and Node.js.

tyo-mq is a lightweight message broker: producers publish events, consumers subscribe to them, and the server routes messages between them over WebSockets — with optional authentication, multi-tenant realm isolation, durable queues, delivery guarantees, MQTT-style topic routing, and multi-node clustering. The browser is a first-class client.

npm install tyo-mq
const { Server, Factory } = require('tyo-mq');

new Server().start();                       // broker on port 17352

const mq = new Factory({ host: 'localhost', port: 17352, protocol: 'http' });
const producer = await mq.createProducer('weather-station');
const consumer = await mq.createConsumer('dashboard');

consumer.subscribe(producer.name, 'temperature', (data) => console.log(data));
producer.produce('temperature', { celsius: 21.5 });

Feature highlights

Area What you get
Pub/sub Named producers and consumers, per-event subscriptions, large-message chunking (256 KB frames), reconnect awareness
Auth & realms Opaque tokens, HS256 JWTs, external validators (scopable per realm/prefix); full multi-tenant isolation per realm; permanent or [[Ephemeral Realms
Connection authorization Per-realm pre-shared keys for consumers, acceptance flow for producers, manual approval for managers
Durability Pluggable storage (memory / SQLite / Redis / custom), offline delivery, per-message TTL
Reliability Per-subscription ACK, retry with backoff, dead-letter queue with replay
Routing MQTT-style topic wildcards (+, #), consumer groups (round-robin), realm and group broadcast
Observability Opt-in HTTP API: health, Prometheus metrics, live stats, DLQ inspection
Management Signed socket commands (admin token never crosses the wire), interactive CLI, web manager UI
Abuse protection Opt-in [[Rate Limits and Quotas
Clustering Multi-node deployment over one shared Redis: settings sync, cross-node routing, shared authorization requests
Remote streaming /remote namespace for one-time-ticket binary streaming sessions (screen frames, input relay)

Where to start

All features beyond basic pub/sub are opt-in — a default server behaves like the original simple broker, and every release is backwards compatible with existing clients.

Status

Current version: 0.11.x. All six phases of the improvement plan are implemented; see Versioning and Roadmap. Licensed under Apache-2.0.

Clone this wiki locally