LearnNewsExamplesServices
Frontmatter
id2221
titleCreate a PoC for a direct communication between the App and Data workers
stateClosed
labels
enhancement
assigneestobiu
createdAtJun 1, 2021, 7:53 AM
updatedAtJun 1, 2021, 2:14 PM
githubUrlhttps://github.com/neomjs/neo/issues/2221
authortobiu
commentsCount1
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
blockedBy[]
blocking[]
closedAtJun 1, 2021, 2:14 PM

Create a PoC for a direct communication between the App and Data workers

Closed v8.1.0 enhancement
tobiu
tobiu commented on Jun 1, 2021, 7:53 AM

Peter and Rodney gave me a heads up on this one inside the working draft podcast yesterday: https://developer.mozilla.org/en-US/docs/Web/API/Channel_Messaging_API

I was not aware, that we can pass ports through post messages.

In short: so far the communication between App and Data always pass through a main thread. This is a pain point and not needed. I was planning to resolve it once sub-workers are implemented, but we can probably do this right now.

Idea: Once the data worker is created, it creates a new MessageChannel(). It sends its port2 through main to the app worker. From there on, the app worker can use this port to directly send messages.

Follow up ticket: if the PoC works out fine, the data worker could always be a dedicated worker (even for multi window apps).

tobiu added the enhancement label on Jun 1, 2021, 7:53 AM
tobiu assigned to @tobiu on Jun 1, 2021, 7:53 AM
tobiu referenced in commit cec8a05 - "https://github.com/neomjs/neo/issues/2221" on Jun 1, 2021, 9:28 AM
tobiu referenced in commit 28669b9 - "#2221 worker.Base: workerPorts config" on Jun 1, 2021, 1:18 PM
tobiu referenced in commit 94302e2 - "#2221 worker.App: registering the Data port, worker.Data: registering the App port" on Jun 1, 2021, 1:21 PM
tobiu referenced in commit 7243992 - "Create a PoC for a direct communication between the App and Data workers #2221" on Jun 1, 2021, 2:13 PM
tobiu
tobiu Jun 1, 2021, 2:14 PM

Screenshot 2021-06-01 at 14 12 24

tobiu closed this issue on Jun 1, 2021, 2:14 PM