finds.dev

primus/primus

Primus, the creator god of the transformers & an abstraction layer for real-time to prevent module lock-in.

View on GitHub

★ 4,471JavaScriptMITupdated Nov 2023

// the take

Primus is a Node.js abstraction layer over real-time transports (WebSockets, Engine.IO, SockJS, etc.) that gives you a single API regardless of which underlying library you use. It was built when the real-time framework landscape was fragmented and volatile — the pitch was that you could swap transports without rewriting your app. That problem is mostly solved now.

The reconnection logic is genuinely well-thought-out: randomized exponential backoff with configurable strategies (disconnect, online, timeout) that you'd otherwise have to wire yourself. The plugin system is clean — server and client both get extended through the same interface, so a plugin author only writes the logic once. Stream-compatible interface on both ends means you can pipe data around without any adapter code. The client library is compiled server-side with the transformer baked in, so there's no runtime negotiation and no config mismatch between client and server.

Last commit was November 2023 and several of the supported transformers (BrowserChannel, uws, Faye) are abandoned or unmaintained — you're abstracting over a graveyard. The abstraction has a real cost: spark.write() returns true/false with no back-pressure, and the docs explicitly say flow control isn't handled. If you're just using WebSockets in 2024, Socket.IO or a bare ws server with your own reconnect logic is simpler and better supported. The client library regeneration requirement on every deploy is a footgun — miss it once and your client and server are silently out of sync.

We read the README, the directory tree and a key source file in June 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
4,471
Forks
269
Language
JavaScript
License
MIT
Last commit
6 Nov 2023

// nearby

If primus isn't quite it.

All repos →