Questions tagged [message-channel]

The `MessageChannel` interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two `MessagePort` properties.

The Channel Messaging API allows two separate scripts running in different browsing contexts attached to the same document (e.g., two IFrames, or the main document and an IFrame, or two documents via a SharedWorker) to communicate directly, passing messages between one another through two-way channels (or pipes) with a port at each end. In this article we'll explore the basics of using this technology.

Source: MDN Web API Reference - Channel Messaging API

Related APIs

28 questions
6
votes
0 answers

How to implement effective two way communication with service worker and client web page

I want to implement effective 2 way communication between service worker and client web page. here is my code function twoWayMsg() { if (navigator.serviceWorker.controller) { var messageChannel = new MessageChannel(); …
5
votes
1 answer

Stuck in postMessage and MessageChannel

I'm confused with postMessage and MessageChannel. Here are some codes from MDN: var channel = new MessageChannel(); var para = document.querySelector('p'); var ifr = document.querySelector('iframe'); var otherWindow =…
L_K
  • 2,838
  • 2
  • 16
  • 36
3
votes
0 answers

Why MessageChannel blocks forever and the client never gets message?

I have a problem where my MessageChannel does not send a message from a service worker to a client. Why MessageChannel blocks forever and the client never gets message? In the sw on fetch event I create a MessageChannel then I do postMessage,…
vardius
  • 6,326
  • 8
  • 52
  • 97
2
votes
0 answers

How to get two iframes to communicate?

I'm trying to get two iframes to communicate, with little luck. I think postMessage() or Message Channel API (are they one & the same?) is the way to go, but I don't control the parent window. In other words, the structure is this: [parent window…
ffxsam
  • 26,428
  • 32
  • 94
  • 144
2
votes
1 answer

Using MessageChannel() bidirectionally for multiple messages between page and iframe

I'm using MessageChannel() to pass messages between a page and iframe. In my scenario, the iframe is the communications initiator and the page containing it receives, transforms and responds back to the iframe. As I was implementing the system I at…
jchristof
  • 2,794
  • 7
  • 32
  • 47
2
votes
1 answer

window.opener does not work in Excel for Windows

I have built an Excel add-in, it opens a popup by window.open, then the add-in communicates with the popup site. I just realised that it does NOT work in Excel for Windows, the reason is that the popup can NOT get the host by $window.opener. To…
SoftTimur
  • 5,630
  • 38
  • 140
  • 292
2
votes
1 answer

Use transferable objects with a shared worker

When using transferable objects in my shared workers I receive null for event.data in the main thread. After some searching I found this post where is explained that the ArrayBuffer is always lost when it is passed through a MessagePort of a…
Wilt
  • 41,477
  • 12
  • 152
  • 203
1
vote
1 answer

What is the best way to schedule a small task to execute as fast as possible, while still making it wait for UI updates?

I'm reading a bit about micro tasks and such, because at the moment I have a project that is poorly optimized and some tasks make the UI hang. I've solved 95% of that by using a (Service) Worker for the heaviest tasks. But there's still some code…
1
vote
0 answers

Spring Itegration. Send Slack notification WebFlux

I need to send a slack message in many parts of the flow indication the file processing information and continue with the main flow. I didn't found a totally straightforward way of doing it Here my solution up to now: Declare a queue channel to…
1
vote
2 answers

what to use for instant messaging capabilities?

I am appearing for the microsoft exam 70-486. While going through the dumps I came across the below question You are developing an ASP.NET MVC application that provides instant messaging capabilities to customers. You have the following…
Shahzad Ahamad
  • 809
  • 1
  • 11
  • 30
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
1
vote
1 answer

Spring Splitter output to multiple channels

I am using the splitter to split the messages and to pass it to the respective other channels for further processing. But I wanted to send the splitter output to one channel which will write it into another file. Also wanted to send the splitter…
kattoor
  • 195
  • 14
1
vote
1 answer

Service Worker Respond To Fetch after getting data from another worker

I am using service workers to intercept requests for me and provide the responses to the fetch requests by communicating with a Web worker (also created from the same parent page). I have used message channels for direct communication between the…
tapananand
  • 4,392
  • 2
  • 19
  • 35
0
votes
0 answers

when is MessagePort garbage collected, and when should I call .unref()?

In the past, I've seen that using a MessageChannel or MessagePort will prevent my process from exiting when it is done. I see there's an .unref() method on MessagePort that can be called, but the docs aren't very clear on how best to use it. Do I…
Sophie Alpert
  • 139,698
  • 36
  • 220
  • 238
0
votes
0 answers

How to use MessageChannel with an iframe in Vuejs Template

We need to display data from an external site in an iframe while also being able to listen for events. I can get the iframe to render with the url that is returned from the API. Where is am stuck is with eventHandlers and…
Greg Fielding
  • 517
  • 3
  • 10
  • 26
1
2