Skip to content

Open source · Rust · Apache-2.0

Pub/sub that remembers where you left off.

A publish/subscribe broker over WebSockets, written in Rust. One binary, a data directory, and a JSON protocol any language can speak.

docker pull ghcr.io/soumyadepp/popsub:0.2

popsub-try

$ node example.mjsorders/42 #1: order 42 shipped^C$ node publish.mjs orders/cli "order 43 placed"published orders/cli #1$ node publish.mjs orders/cli "order 44 placed"published orders/cli #2$ node example.mjsorders/cli #1: order 43 placedorders/cli #2: order 44 placedorders/42 #2: order 42 shipped
The subscriber stops, two messages go to a topic it has never seen, and it starts again. It prints both, in order, and doesn't repeat orders/42 #1.

What you get

Small enough to read. Careful where it counts.

Topic logs

Every message gets a sequence number in its topic's log. Subscribers replay history, resume after a disconnect or a server restart, and spot duplicates.

Durable sessions

Name a session when you connect, and your subscriptions and acknowledgement positions survive disconnects and server restarts.

QoS 0 and QoS 1

QoS 1 is at-least-once per subscriber. A message that runs out of retries pauses that subscription, or goes to a dead-letter topic if you set one.

Wildcards and groups

Subscribe to orders/# or sensors/+/temp, or share a topic across a group of workers so each message goes to one of them.

Users and permissions

Per-topic grants, Argon2id passwords, JWTs and rate limits. Change accounts on a running server, and live connections follow at once.

Four client libraries

Rust, TypeScript, Python and Go handle login, reconnection, resubscription, acknowledgements and deduplication, each held to one shared scenario suite.

Thirty seconds of code

Subscribe, publish, and pick up where you stopped

Subscribe to every topic under orders/, publish one message and wait until it is stored, then print what arrives. The session name means a restart carries on from where it stopped, and starting from seq 1 also picks up topics created while it was away.

import { Client } from "popsub";
const client = await Client.connect({
url: "ws://127.0.0.1:8080",
credentials: { username: "alice", password: "alice-password" },
sessionId: "orders-worker",
});
const messages = await client.subscribe("orders/#", { seq: 1 });
await client.publishConfirmed("orders/42", "order 42 shipped");
for await (const message of messages) {
console.log(`${message.topic} #${message.seq}: ${message.payload}`);
}

Install

One server, four client libraries

TypeScript

npm ↗
npm install popsub

Where it fits

One process, no clustering, honest about it

A good fit

  • Small applications that want durable realtime messaging on one machine.
  • Browsers, services and workers in different languages on one broker.
  • Teams that want delivery guarantees written down precisely.

Look elsewhere

  • Replication or high throughput today: NATS JetStream or Kafka.
  • Devices that only speak MQTT: Mosquitto or EMQX.
  • A stable API: PopSub is 0.x, and the known gaps are listed in priority order.