Frontmatter
| id | 2221 |
| title | Create a PoC for a direct communication between the App and Data workers |
| state | Closed |
| labels | enhancement |
| assignees | tobiu |
| createdAt | Jun 1, 2021, 7:53 AM |
| updatedAt | Jun 1, 2021, 2:14 PM |
| githubUrl | https://github.com/neomjs/neo/issues/2221 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| blockedBy | [] |
| blocking | [] |
| closedAt | Jun 1, 2021, 2:14 PM |


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 itsport2through 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).