Skip to content
Latchkey

What Is a Shared Worker?

A shared worker is a background script that several documents from the same origin can connect to simultaneously, all talking to a single worker instance. Each connection communicates through a port, and the worker can coordinate state across tabs. This makes it useful for shared resources like a single websocket or a common cache.

Why it matters

A dedicated web worker exists per page, so multiple tabs duplicate work and connections. A shared worker centralizes that, letting tabs share one connection or computation and stay in sync.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →