Skip to content

CodeThicket/tabmesh

Repository files navigation

TabMesh

One backend connection, every browser tab. SharedWorker-primary event mesh with elected-leader fallback.

License: MIT Status: pre-1.0 Docs

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-websocket
import { 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.

Documentation

tabmesh.dev — full docs, recipes, API reference → Quickstart — install through first cross-tab event → Gotchasread this before adopting in productionArchitecture — SharedWorker primary, elected-leader fallback, outbox → Playground — live multi-tab demo → Roadmap — what's next, considered, out of scope

Status

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.
  • delivered semantics will tighten when ackMode: '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.

Development

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

License

MIT © TabMesh Contributors

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors