GoogleChromeLabs / GoogleChromeLabs/comlink

Explicitly mention in the document of Comlink's limitation on bidirectional communication between main thread and worker

Open
#672 0 comments 5 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
12.8k
Forks
435
PR merge metrics
No merged PRs in 30d

Description

There appears to be a fundamental limitation when attempting to use Comlink to enable bidirectional communication between the main thread and a worker thread simultaneously. Current behavior suggests that Comlink only supports unidirectional communication effectively, meaning that either the main thread can expose and the worker can consume, or vice versa, but not both ways at once. **Explicit guidance on this in the documentation could help avoid confusion and save time troubleshooting.**

Expected Outcome:
It would be beneficial if the documentation could explicitly mention:

1. Why Comlink does not support simultaneous bidirectional exposure (main ⇄ worker).
2. Any underlying technical constraints, such as those related to structured cloning or transferables, that impact this behavior.
3. Workarounds or best practices for developers needing two-way interaction.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.