grpc-over-datachannels started the way most multi-language
projects do: one WebRTC stack (ICE, DTLS, SCTP) written in
Rust, then mirrored by hand into Go and JavaScript so each
native stack could run standalone. Three implementations
of the same protocols, kept in sync by discipline and a
conformance suite.
That discipline already failed once. In v0.32 a fragment
reassembly bug — fragments merged across a message
boundary — wedged ordered delivery in one stack while the
others were fine. The fix taught us the actual lesson: the
state machines that must not drift should not exist three
times. So 0.44.0 deletes two of them.
Sans-io cores, two consumption shapes
The Rust stack was already mostly pump-driven: feed a
datagram in, get packets and events out, no sockets or
threads inside. We finished that extraction for all three
protocols:
- SCTP:
dc-sctp-ffi(C ABI) +dc-sctp-wasm - DTLS: the handshake lifted into a resumable flight machine (
DtlsHandshake),dc-dtls-ffi+dc-dtls-wasm - ICE: the agent turned out to be sans-io already; gathering/TURN/mDNS were always host-side.
dc-ice-ffidc-ice-wasm
Go consumes the cores through cgo behind small seams
(sctpAssoc, DtlsConn, the IceAgent API). JavaScript
consumes the same cores compiled to Wasm. The browser
bridge and every generated facade language ride the same
Rust runtime. There is now exactly one SCTP, one DTLS,
and one ICE implementation in the project.
The honest cost: about 311 ns per delivered message
across the FFI versus 173 ns for the old mirrored Go
stack. We measured it, and we'd pay it again: it's the
price of one conformance-tested implementation instead of
three that can drift. Throughput on the echo path is
~8,300 messages/second at 0.36 ms mean RTT (mux_bench).
Flipping the defaults found the bugs
The mirrors stayed as the default until every consumer
was wired. Flipping Go and JS to the Rust cores — then
deleting the mirrors — is where the interesting failures
lived:
- The DTLS pump that died on
undefined. In the Wasm adapter, one non-application DTLS record (a session ticket) mapped Rust'sNoneto JavaScriptundefined, the receive check tested only fornull, and every endpoint pump threw. Sequential tests passed; eight concurrent rendezvous dials killed all eight pumps. - The 64-packet queue. Bursty MiB messages overflowed the peer's small DTLS demux queue; the drops became SCTP retransmit storms and truncated chunk echoes — but only on the (slightly slower) FFI path. The queue is 4096 deep now, and there's a permanent queued tail-drop blast regression test in the Rust suite.
- A registry test that raced itself. Two client endpoints shared one in-memory transport and raced for frames; it hung for 9m56s in GitHub CI before timing out (that failure is what the current public CI red was sitting on). One transport pair per client; fixed.
- Public CI archaeology. The generated repos' Go, browser, and interop jobs each needed the cores built before use — three generator fixes, shipped as export fixups.
Oracles without mirrors
Deleting a second implementation deletes your differential
oracle, so the conformance net is now mirror-free by
design: OpenSSL differentials for DTLS (dtls_openssl,
crypto_openssl), the shared SCTP vectors through every
surface, the ICE consent/trickle suites against the core,
and full Go + JS suites that only have the Rust path to
run on. make ci-status sweeps the generated repos'
CI in one command; it's all green on v0.44.0.
The mirrors totaled roughly 4,400 lines of Go and
JavaScript. What's left is one stack, maintained once,
spoken everywhere.
![Physical AI Foundations and Definitions — Ch.10: Future Directions [EN]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgz7t8gzrdba0obh9ma56.png)
![Physical AI Foundations and Definitions — Ch.08: Physical AI Product Strategy [EN]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F4gyormoamcida6t18mdw.png)
![Physical AI Foundations and Definitions — Ch.07: Relation to AMR Manipulator Humanoid Quadruped UAV [EN]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fte7aqbjpqzqiay6cht0x.png)
![Physical AI Foundations and Definitions — Ch.05: Physical AI Taxonomy [EN]](https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxeb66tbhskewzsz49i7p.png)