Synclets logoSynclets

createBroadcastChannelTransport

The createBroadcastChannelTransport function wraps a BroadcastChannel in a BroadcastChannelTransport implementation.

createBroadcastChannelTransport(
  channelName: string,
  options?: TransportOptions,
): BroadcastChannelTransport
TypeDescription
channelNamestring

The name of the BroadcastChannel to use.

options?TransportOptions

Optional TransportOptions for configuring the transport.

returnsBroadcastChannelTransport

A BroadcastChannelTransport instance for cross-tab communication.

This transport enables real-time synchronization between Synclets running in different browser contexts (tabs, windows, iframes) within the same origin. It uses the browser's BroadcastChannel API for efficient, same-origin communication without requiring a server.

The transport is only available in browser environments that support the BroadcastChannel API (all modern browsers). It provides automatic fragmentation for large packets and bidirectional communication between all contexts sharing the same channel name.

This is ideal for synchronizing state across multiple tabs or windows of the same web application without server involvement.

Since

v0.0.0