BroadcastChannel is a JavaScript library for sending messages between different browser tabs, Node.js processes, and Deno Deploy instances. It provides a consistent communication layer for environments that need cross-context coordination without relying on a server. The library works completely client-side and offline in supported browser use cases. It is tested across old browsers, modern browsers, Web Workers, iframes, and Node.js. It also includes leader election over channels, which helps multiple contexts decide which one should perform a shared task. It is useful for multi-tab synchronization, offline-first applications, shared state coordination, and browser apps that need to avoid duplicated background work.
Features
- Cross-tab message broadcasting
- Node.js process communication
- Deno Deploy instance support
- Client-side offline operation
- Web Worker and iframe compatibility
- Leader election over channels