One backend connection, every browser tab. SharedWorker-primary event mesh with elected-leader fallback.
Open the same web app in three tabs and you'll typically see three independent WebSockets, three copies of the same push notification, three idle reconnect storms when the network blips. TabMesh collapses that to one WebSocket shared by all tabs, an IndexedDB-backed outbox so closing a tab doesn't drop events, and real-time event delivery between tabs.
pnpm install @tabmesh/core @tabmesh/transport-websocketimport { TabMesh } from '@tabmesh/core';
import { WebSocketTransport } from '@tabmesh/transport-websocket';
const mesh = new TabMesh({
channelName: 'my-app',
transport: new WebSocketTransport({ url: 'wss://api.example.com' }),
workerVersion: process.env.GIT_SHA,
});
await mesh.start();
mesh.on('chat.message', (event) => console.log(event.payload, event.source));
await mesh.send({ type: 'chat.message', payload: { text: 'Hello' } });Plus a one-time copy of the SharedWorker bundle into your app's public/ directory — docs walk through it.
→ tabmesh.dev — full docs, recipes, API reference → Quickstart — install through first cross-tab event → Gotchas — read this before adopting in production → Architecture — SharedWorker primary, elected-leader fallback, outbox → Playground — live multi-tab demo → Roadmap — what's next, considered, out of scope
Pre-1.0. The core API works and is exercised by 122 unit tests and an 11-test Playwright harness, but:
- API may change before 1.0 in response to real-world feedback.
deliveredsemantics will tighten whenackMode: 'server'lands.- SSE / long-poll transports and Vue / Svelte adapters are roadmap, not shipped.
If you're trying TabMesh and hit a sharp edge, open an issue. The shape of those issues is what 1.0 needs to settle.
pnpm install
pnpm test # vitest, ~120 unit tests
pnpm test:e2e # playwright (requires `pnpm exec playwright install chromium` once)
pnpm typecheck
pnpm biome:check
pnpm docs:dev # local docs site→ CONTEXT.md — domain language and design notes
→ docs/adr/ — architecture decisions, served publicly at tabmesh.dev/adr
MIT © TabMesh Contributors