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).
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
WorkerEntrypointon a public HTTP route using Cap'n Web. Then, when aWorkerEntrypointis 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).