Questions tagged [broadcast-channel]

The Broadcast Channel API allows simple communication between browsing contexts (that is windows, tabs, frames, or iframes) with the same origin (usually pages from the same site).

By creating a BroadcastChannel object, which is listening to the underlying channel, you are able to receive any message that has been posted to it. An interesting point is that you no longer have to maintain a reference to iframes or workers that you wish to communicate with. They can simply “subscribe” to particular channels by constructing a BroadcastChannel, and have full-duplex (bi-directional) communication between all of them.

See MDN Web API Reference - Broadcast Channel

Related APIs

43 questions
2
votes
1 answer

Is JavaScript's broadcast channel limited to one received message per second?

I may have answered this question for myself but I need to sanity check... I have one tab broadcasting to another over the broadcast channel every 500 ms. The second tab is set to receive broadcasts and print them in the console log. Sending…
JLowther
  • 236
  • 2
  • 9
1
vote
3 answers

Bugfender: ReferenceError: Can't find variable: BroadcastChannel

I am using bugfender in my vue js application, which works fine in Chrome but doesn't work in my Safari Mac. Safari Version 15.3 (17612.4.9.1.5) @bugfender/sdk: 2.2.2 Error in browser console: ReferenceError: Can't find variable: BroadcastChannel I…
Prachit Patil
  • 413
  • 5
  • 9
1
vote
0 answers

Communicating two tabs on two devices in javascript using broadcast channel

I need some advice on whether I need to reimplement my project or I can make the current implementation work. I have implemented a user interface to do some wizard of oz testing. I have a user-side page (Page A), which fires up a second page, the…
nightrain
  • 306
  • 1
  • 3
  • 13
1
vote
1 answer

How to implement Broadcast Channel API in React

I need to check when the user opens a new tab if there any other tabs are opened in the browser. So when we can able to find that there are no tabs opened already, then we need to do some operations if not we can just leave How can we achieve this…
Dante1021
  • 304
  • 7
  • 20
1
vote
0 answers

How BroadcastChannel API handles multiple/concurrent messages?

Have a scenario, where 3 tabs are communicating via Broadcast channel API. But if one of the tab is taking some time to execute onMessage event (due to some delay) what will happen to new messages. Example : tab 1 : have a debug point in…
1
vote
1 answer

React Getting error with BroadcastChannel API

I am using sessionStorage to keep the auth information and need to replicate this information to other tabs being opened. I have created a codesandbox to recreate the issue. I didn't include code in this post since it is quite lengthy. When the…
1
vote
2 answers

How can I duplicate a media stream to a popup window?

I want to start a screen share in my main tab by calling getDisplayMedia, and then clone it to another popup window which I open from my app (using window.open), effectively showing the screen capture twice, in parallel. According to this thread,…
1
vote
1 answer

Javascript: Get BroadcastChannel Subscriber Count

How do I tell if Broadcast channel exists and its subscriber count? We have a product link, and some chrome page tabs are subscribing to a Broadcast channel. Want to see how many are listening. const bc = new…
user12425844
1
vote
1 answer

Issue with broadcast channel when using with nodejs worker_threads module

I am writing a nodejs script. In that I have created a worker using worker_threads and a BroadcastChannel. I am not able to send message from my main thread to worker threads. However, I am able to send message from Worker to main thread. Following…
Anusha Bhat
  • 99
  • 1
  • 12
1
vote
1 answer

BroadcastChannel / MessageEvent timestamp?

BroadcastChannel messages have a timeStamp property. The timeStamp property is a number (previous examples have been 769585.9000000637, 14569.200000027195, 305355.4000000004). You can get your own sense of this by copy/pasting the below code into a…
LShapz
  • 1,738
  • 11
  • 19
1
vote
0 answers

How to broadcast data from child window to parent modal popup in angular js

I have to broadcast data from child window to parent modal popup controller from which new window originated
0
votes
1 answer

BroadcastChannel is losing .postMessage() context in setInterval function

This timing class wired from a Web Worker does not retain context for the BroadcastChannels postMessage() method. When in use it throws a error: Uncaught TypeError: this.channel.postMessage is not a function The error occurs when the emit() method…
ServerStorm
  • 59
  • 1
  • 9
0
votes
1 answer

BroadcastChannel API inconsistently throws error if it was closed when calling postMessage()

When working with BroadcastChannel API, I realized that there's a case where if the channel is closed and the developer still try to call postMessage(), there won't be any exception thrown; at least not all the time. First case close() is called…
Envil
  • 2,687
  • 1
  • 30
  • 42
0
votes
0 answers

Testing BroadcastChannel API using JEST

I have implemented cross-browser tab communication using the broadcast channel API in my React Project. It's working as expected in the browser, but I am struggling to write unit tests for it using JEST. When I run the test case, the post message…
0
votes
0 answers

Sharing Websocket connection between multiple tabs?

I'm having difficulty figuring out the best method of sharing a WebSocket connection between multiple tabs. It seems like BroadcastEvent and SharedWorker are two modern APIs that can be used for this task. BroadcastEvent and SharedWorker seem like…