Wire protocol families (interop vs Deuk native)
The same string names for --protocol, npm serialize / deserialize, and generated C# / C++ code sit on top of two families. Use this page to see which stack implements which wire.
한국어: Use the site language menu → 한국어 for the same page in Korean.
1. Family (wireFamily)
| Value | Meaning |
|---|---|
interop |
Thrift-compatible bytes and semantics |
deuk |
Deuk-native wire (what the npm JS serializer implements) |
The protocol string must match the family. Use WireProtocolOption, deukWire(), or interopWire() in the core types when you want the family fixed in the type system. Details: Interop vs native wire.
2. Protocol matrix (by language runtime)
Interop family (interop) — Thrift
Only these protocol strings are valid: tbinary, tcompact, tjson. Older spellings such as binary / compact / thrift_json are not accepted by the CLI or types.
protocol |
Role | JS WireSerializer |
Generated C# / C++ |
|---|---|---|---|
tbinary |
Thrift Binary | Implemented when you pass interopRootStruct (+ optional interopStructDefs for nested types) |
DpBinaryProtocol, etc. |
tcompact |
Thrift Compact | Same | DpCompactProtocol, etc. |
tjson |
Thrift JSON wrapper (DpJsonProtocol) |
Same | C# and other runtimes |
Without a root struct schema, JS throws a clear error (the engine cannot infer field ids). Use serializeInteropStruct / deserializeInteropStruct or WireSerializer with SerializationOptions filled from parse/schema. Generated C# / C++ remains the main path for app-sized stacks.
Protobuf byte wire (planned)
Google Protobuf-style byte encoding (protv2 / protv3 profiles) is on the roadmap, not shipped yet. Until then, use Thrift interop (tbinary / tcompact / tjson) or Deuk native wires. protv2 / protv3 may still appear in docs as field-rule labels only.
Deuk native family (deuk)
protocol |
Role | JS WireSerializer |
Generated C# / C++ |
|---|---|---|---|
pack |
Tagged binary (Deuk native) | Implemented | Reader/Writer for that family |
json |
UTF-8 JSON (values only) | Implemented | Same family |
yaml |
UTF-8 YAML (values only) | Implemented | Same family |
CLI --protocol default (codegen hint): pack. Interop CLI values are tbinary / tcompact / tjson; legacy binary is normalized to tbinary.
3. npm serialize / deserialize (simple API)
- Default format argument:
pack(Deuk native binary) when omitted. - You can pass
wireFamilyso it stays consistent withprotocol; mismatches are rejected.
import { serialize, deserialize } from 'deukpack';
// default = pack (deuk family)
const bytes = serialize(obj);
For Thrift Binary/Compact/JSON from JS, supply interopRootStruct (and interopStructDefs if needed). For pack / json / yaml, no struct metadata is required.
4. CLI --protocol and codegen
--protocol |
Family | Wire role |
|---|---|---|
pack, json, yaml |
deuk |
Deuk native |
tbinary, tcompact, tjson |
interop |
Thrift compatible |
One value per codegen pass; split output dirs or use --pipeline for multiple wires.
5. Two different json stories
- Deuk native
json/yaml: value-only JSON/YAML on the wire — see DEUKPACK_DEUK_JSON_YAML (vs.deuk.jsonconfig files). tjson: Thrift JSON compatibility family — not the same as nativejson.
6. See also
- Protocol — product overview
- Tutorial · Protocol & serialization — how to choose
- Messages & wire — msgId, Registry, partial send
- API reference — CLI — full flags