Protocol
A protocol — a service in Protobuf, an interface in Cap'n Proto — is a set of functions a caller can invoke.
Functions
- Arguments are
Typeorname: Type, comma-separated:function send(Message)orfunction send(msg: Message). - Return is
-> Type; omit it for a one-way call. ! ErrorNamedeclares that the function can raise a givenerror.- Every function ends with
;.
Functions take docstrings (including the /// @name: form for
arguments) and @key=value annotations.
Protocol annotations
A @key=value annotation on the protocol itself configures the whole service.
@framingpicks the wire framing the generated client and server use."jsonrpc"(json-rpc,jsonrpc-2.0) emits a JSON-RPC 2.0 stack; omit it for the default compact datagram framing. Both ends of a connection must agree — the handshake refuses a mismatch.
How a call travels between caller and implementation is the runtime's job, over a pluggable call system.