-
System OverviewMy system involves three actors:
Communication Protocols
The ChallengeI need to bridge gRPC's async API with the Cap'n Proto KJ async framework in the Local Server. Has anyone successfully integrated gRPC (or another async library like ASIO) with the KJ framework? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
Unfortunately, this is likely to be hard. In C++, gRPC has its own event loop that it wants to use, and you generally can't run two event loops in the same thread. There are two options:
|
Beta Was this translation helpful? Give feedback.
Unfortunately, this is likely to be hard. In C++, gRPC has its own event loop that it wants to use, and you generally can't run two event loops in the same thread. There are two options:
kj::newPromiseAndCrossThreadFulfiller()for signaling) to communicate between them.kj::EventPortwhich wraps gRPC's underlying event loop, so that KJ code can operate inside gRPC's loop. This is non-trivial, but it has been done -- node-capnp, for example, implements an EventPort on top of libuv which successfully allowed Cap'n Proto to run inside Node. (Note: That co…