-
Notifications
You must be signed in to change notification settings - Fork 0
Getting Started
npm install tyo-mqRequires Node.js. The browser client ships pre-bundled (see Browser Client).
The quickest way — the packaged entry point:
npm start # from a clone of the repo; listens on port 17352Or embed it in your own process:
const Server = require('tyo-mq').Server;
const server = new Server({
// any socket.io options are accepted here too
});
server.start(); // default port 17352
// server.start(9000); // or pick a portEverything beyond plain pub/sub (auth, persistence, clustering, the HTTP API) is off by default and enabled through options or a settings file — see Server Configuration.
const Factory = require('tyo-mq').Factory;
const mq = new Factory({ host: 'localhost', port: 17352, protocol: 'http' });
const producer = await mq.createProducer('weather-station');
producer.produce('temperature', { celsius: 21.5 });produce(event, data) is fire-and-forget by default. Options for TTL,
guaranteed delivery, and broadcast are covered in Producers.
const consumer = await mq.createConsumer('dashboard');
consumer.subscribe('weather-station', 'temperature', (data, from) => {
console.log('from', from, ':', data);
});Subscriptions survive reconnects automatically: if either side drops and comes back, the subscription is re-established and both sides are notified of each other's online state.
Consumer names must be unique per realm — a second live connection
registering the same consumer name is rejected (it almost always means two
instances share one app_id).
A single process can be producer and consumer at once:
const worker = await mq.createProducer('worker-1');
const feed = await mq.createConsumer('worker-1-feed');Messages bigger than 256 KB are automatically split into ordered chunks and reassembled on the receiving side — multi-megabyte payloads work without any configuration (the server defaults to a 50 MB socket.io frame ceiling).
- Add authentication and tenant isolation: Authentication and Realms
- Keep messages for offline consumers: Persistence and Durable Delivery
- Guarantee processing: ACK, Retry and the Dead Letter Queue
- Route hierarchically: Topics and Wildcards
tyo-mq · README · Improvement Plan · Clustering Guide · Apache-2.0
Basics
Security
- Authentication and Realms
- Ephemeral Realms
- Roles and Connection Authorization
- Authorization Requests
Delivery
Routing
Operations
Reference