Synclets logoSynclets

createBroadcastChannelTransport

The createBroadcastChannelTransport function wraps a BroadcastChannel in a BroadcastChannelTransport implementation.

createBroadcastChannelTransport(options: BroadcastChannelTransportOptions): BroadcastChannelTransport
TypeDescription
optionsBroadcastChannelTransportOptions

Options including the channel name and transport settings.

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