cloudflare / cloudflare/capnweb
exposing `WorkerEntrypoints` via Cap'n Web
- Dominant language
- TypeScript
- Stars
- 4k
- Forks
- 143
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 7
Description
Currently a Worker can call another Worker over RPC using a service binding. This uses the runtime's built-in type system. The target worker implements the RPC interface as a class extending `WorkerEntrypoint`, and exports that.
We should let people expose the same `WorkerEntrypoint` on a public HTTP route using Cap'n Web. Then, when a `WorkerEntrypoint` is mapped to an HTTP endpoint, the developer should be able to enable automatic Cap'n Web support, making the entrypoint's RPC methods available to the internet.
When we do this, the Worker itself does not need to import the Cap'n Web library. Instead, it strictly speaks runtime-native RPC. We could bridge this to Cap'n Web in a separate isolate we maintain ourselves (with the possibility of optimizing it to native code someday).
Contributor guide
Assessment
This issue has not been assessed yet.