<pacem-broadcastchannel-proxy> lets the tabs of your site talk to each other: the cart badge that updates everywhere, the "logged out" that logs out every tab.
Same channel-name, and a message sent here shows up as result there.
<pacem-broadcastchannel-proxy channel-name="cart" message="{{ #cart.model.count }}"
on-receive="#cart.model = { count: $event.detail }"></pacem-broadcastchannel-proxy>
Tune in. Every proxy with the same channel-name, in any tab or frame of the same origin, shares the channel.
Change the name and the proxy moves to the new channel.
Send. With autosend (the default), every change of message goes out; turn it off and call send() (or send(something)) when you mean it.
Messages are structured-cloned: objects and arrays travel fine, functions and DOM nodes don't.
Receive. An arriving message lands in result and fires receive ($event.detail is the message).
A channel never hears its own messages: the other tabs do (and so do other proxies of the same name on this page). Echoing a received value back with autosend is harmless: an unchanged
messageisn't sent again.
Two proxies on one page play two tabs: logging out in one reaches the other.
autosend="false": typing doesn't broadcast, the button does. Open a second tab to receive it there too.
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.