Something went wrong. Try again.
Cloudflare Cap'n'Web Go implementation
Something went wrong. Try again.
capnweb-go interop
1 folder · 2 files
README.md
Cross-language interop (go-js / js-go) #
This directory is the runnable cross-language example and conformance harness for
capnweb-go. It exercises the Cap'n Web protocol in both directions against
the reference TypeScript implementation (cloudflare/capnweb),
proving the Go implementation is wire-compatible.
What it covers #
| Server | Client | What it proves |
|---|---|---|
| TS | TS | Baseline — reference behavior |
| Go | TS | Go server encodes like the TS server (go → js) |
| TS | Go | Go client decodes like the TS client (js → go) |
The service surface (defined identically in Go testService and TS
TestService) covers: echo, add, greet, fail/failTyped, getChild
(pass-by-reference), collect (streaming), plus the capnweb 0.8.0 features:
makeBlob— aBlobround-trip, asserting MIME type + bytes survive the streaming pipe (["blob", type, ["readable", id]]).failWithProps— anErrorcarrying custom properties (code,detail) and acause, asserting they propagate (["error", name, msg, null, props]).getInvalidDate— an invalidDate, asserting it serializes as["date", null]and decodes back to an invalid/zero date.
Running locally #
You need Go, Node 22+, and a checkout of the reference implementation:
git clone https://github.com/cloudflare/capnweb /tmp/capnweb-ref
cd interop/ts && npm install && cd ../..
CAPNWEB_INTEROP=1 CAPNWEB_PATH=/tmp/capnweb-ref \
go test -race -v -timeout 120s ./interop/...
Without CAPNWEB_INTEROP=1 the tests skip, so the suite is a no-op in
environments that lack Node.
CI #
ci.ymlruns this suite on every PR against a pinned capnweb version (v0.8.0) for deterministic results.nightly.ymlruns it againstcapnweb@latestas a drift alarm: a red nightly means upstream changed the wire protocol and the Go implementation needs to be re-aligned.