New releases

Hotwire Club tooling is now open-source

Explore the agentic skills pack and the MCP server for building assistant workflows.

Stimulus - Inter-Tab Communication

Manage inter-browser communication using Stimulus and the Broadcast Channel API 📡.

View Solution on Patreon
Stimulus - Inter-Tab Communication

Premise

This week’s challenge is part Stimulus exercise, part exploration of a more exotic, but actually quite established browser API - the Broadcast Channel API. It’s an excellent choice for sending low-importance notifications from one browser tab or window to another without having to resort to Websockets. We’ll look at updating some input elements and sending a toast message from one tab to the other.

Here’s a sneak peek:

Inter-Tab Communication Shown By Example of a Household Chore Manager

Challenge

Today’s example is a family chore manager: Chores can be assigned to a family member, and set to done. For your convenience, the markup is already laid here:

Conceive a Stimulus controller to notify other browser tabs of changes:

  • Show a toast when an assignment changes or a task is marked done
  • Change the button’s state in the other browser tab if marked done in this one

Hints:

  • Use one BroadcastChannel for assignments and one for marking tasks done
  • Use the <template> provided in the HTML to clone and insert a toast. Look at the shoelace guide.

Caveats

Note that this API is strictly for inter-tab/-window communication on the same machine.

Teaser

How could the managing of done be made more declarative?

This is The Hotwire Club

46 hands-on challenges with detailed solutions, published biweekly since 2023. Subscribe to access all solutions and join the Discord community.

Subscribe on Patreon

More from

Turbo Streams - Custom Stream Actions - pushState
14 April 2026

Synchronize browser history with Turbo Stream responses using a custom push_state action, a Stimulus controller, and the popstate event.

Turbo Frames - Chained Selects
24 March 2026

Build dependent dropdown menus that update dynamically using Turbo Frames and a small Stimulus controller.

Stimulus - Web Share API
25 November 2025

Use the native browser web sharing capabilities from Stimulus

Cookies
essential