1. Define your .capnp file
Create echo.capnp:
@0xbf5147bb3b06fa3d;
using Go = import "/go.capnp";
$Go.package("echo_capnp");
$Go.import("github.com/appnet-org/arpc/examples/echo_capnp/capnp");
struct EchoRequest {
content @0 :Text;
}
struct EchoResponse {
content @0 :Text;
}
interface EchoService {
echo @0 (req :EchoRequest) -> (resp :EchoResponse);
}
2. Generate Go code
See capnp-gen-arpc for details.
3. Run the client and server
Start the server:
go run server/server.go
In a separate terminal, run the client:
go run frontend/frontend.go frontend/metrics.go
4. Test
curl http://localhost:8080?key=hello