Provider-independent realtime subscriptions for TypeScript.
Simulcast owns the lifecycle of realtime subscriptions. A client holds one connection session. Components listening to the same channel share one native subscription, and the last one to leave releases it. The same API works from React, Vue, Solid, Svelte, or plain TypeScript, over eleven provider adapters.
Documentation · Get started · Live demo · Adapters · Devtools
pnpm add @priemskiyyy/simulcast @priemskiyyy/simulcast-react @priemskiyyy/simulcast-broadcast-channelimport { RealtimeClient } from "@priemskiyyy/simulcast";
import { broadcastChannel } from "@priemskiyyy/simulcast-broadcast-channel";
import { RealtimeProvider, useChannel } from "@priemskiyyy/simulcast-react";
const realtime = new RealtimeClient({
adapter: broadcastChannel({ prefix: "app:" }),
});
const Room = () => {
useChannel<{ text: string }>("rooms:demo", (message) => {
console.log(message.text);
});
return null;
};
export const App = () => (
<RealtimeProvider client={realtime}>
<Room />
</RealtimeProvider>
);Swap broadcastChannel(...) for centrifugo(...) or mqtt(...) and the
component does not change. The full
getting started guide
adds a message list and a send button.
- Shared subscriptions. Components listening to the same channel use one native subscription. The last publication consumer releases it.
- Explicit sessions. Replacing a session reconnects active consumers. Cleanup from an old session cannot disconnect its replacement.
- Passive observation. Status hooks and devtools watch channels without creating demand.
- Typed publications. Infer payload types from parsers, declare event maps, and optionally generate named hooks.
- Provider APIs stay accessible. Register your client once and
useNativeConnection()returns the typed native client; every publication carries the provider's own value. - One adapter contract. Build your own with
createRealtimeAdapterand run the conformance suite against it.
Component A --+
Component B --+-- rooms:123 -- one native subscription
Component C --+
A unmounts -> subscription remains
B unmounts -> subscription remains
C unmounts -> native subscription released
| Normalized | Left to the provider |
|---|---|
| Connection and session ownership | Delivery guarantees and QoS |
| Logical channels and subscription ownership | Presence, history, RPC |
| Shared consumers and deterministic cleanup | Provider-specific recovery |
| Coarse connection and channel state | Authorization models |
| Publication delivery with native context attached | Publishing semantics |
| Diagnostics and devtools |
| Package | Purpose |
|---|---|
@priemskiyyy/simulcast |
Runtime, adapter contract, mock, conformance suite |
@priemskiyyy/simulcast-react |
React and React Native bindings |
@priemskiyyy/simulcast-vue |
Vue composables |
@priemskiyyy/simulcast-solid |
Solid primitives |
@priemskiyyy/simulcast-svelte |
Svelte utilities |
@priemskiyyy/simulcast-devtools |
Browser inspector and framework wrappers |
@priemskiyyy/simulcast-codegen |
Event-hook generation from TypeScript event maps |
| Provider | Package | A channel is |
|---|---|---|
| Centrifugo | @priemskiyyy/simulcast-centrifugo |
Subscription channel |
| Pusher Channels | @priemskiyyy/simulcast-pusher |
Public, private, or presence channel |
| Ably | @priemskiyyy/simulcast-ably |
Realtime channel |
| Supabase Realtime | @priemskiyyy/simulcast-supabase |
Broadcast topic |
| Socket.IO | @priemskiyyy/simulcast-socketio |
Event name |
| Phoenix Channels | @priemskiyyy/simulcast-phoenix |
Channel topic |
| MQTT | @priemskiyyy/simulcast-mqtt |
Topic filter |
| PartyKit | @priemskiyyy/simulcast-partykit |
Room |
| WebSocket | @priemskiyyy/simulcast-websocket |
Your protocol's channel identifier |
| Server-Sent Events | @priemskiyyy/simulcast-sse |
One EventSource URL |
| BroadcastChannel | @priemskiyyy/simulcast-broadcast-channel |
Same-origin channel name |
The adapter comparison
shows which adapters share a connection, who owns retries, and what
realtime.native exposes.
Open the hosted Mission Control demo, then the Simulcast Devtools launcher. Add and remove consumers, watch listener counts, and confirm one native subscription per channel. No backend, account, or credentials.
The inspector works with every binding and never creates subscription demand. Devtools guide.
If Simulcast does not ship an adapter for your realtime system, write one with
createRealtimeAdapter and run testRealtimeAdapter from
@priemskiyyy/simulcast/testing against it. The
adapter guide
covers the contract; coding agents can load the create-adapter skill in
.claude/skills.
Use Node 22.18 or newer and the pnpm version declared in package.json.
pnpm install --frozen-lockfile
pnpm check
pnpm build:docspnpm check builds packages and examples, checks types, lint and formatting, runs
unit and local provider tests, and validates generated hooks. See
CONTRIBUTING.md, the
architecture and invariants,
and RELEASING.md.
