CborSerializer
Defined in: src/serialization/CborSerializer.ts:17
CBOR serializer — compact binary format, used by default for system messages (heartbeats, gossip, handoff) and available for any user type that benefits from smaller payloads than JSON. Handles the same JS primitives as JsonSerializer plus:
Uint8Arrayround-trips as a byte string (no base64 overhead).Dateuses CBOR tag 1.bigintuses CBOR tag 2 / 3.
Manifests are not used by the CBOR serializer itself — the caller is expected to round-trip compatible shapes. For class-preserving round-trips register a dedicated serializer via SerializationExtension.
Implements
Section titled “Implements”Serializer<unknown>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new CborSerializer():
CborSerializer
Returns
Section titled “Returns”CborSerializer
Properties
Section titled “Properties”
readonlyid:2=2
Defined in: src/serialization/CborSerializer.ts:18
Stable identifier that is embedded in every frame. Numbers 1..99 are reserved for the actor-ts built-ins (JSON=1, CBOR=2). User-defined serializers SHOULD use IDs ≥ 100.
Implementation of
Section titled “Implementation of”includesManifest
Section titled “includesManifest”
readonlyincludesManifest:false=false
Defined in: src/serialization/CborSerializer.ts:20
True when this serializer is willing to encode the given value.
Implementation of
Section titled “Implementation of”
readonlyname:"cbor"='cbor'
Defined in: src/serialization/CborSerializer.ts:19
Human-readable name, surfaced in diagnostics.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”fromBinary()
Section titled “fromBinary()”fromBinary(
bytes,_manifest):unknown
Defined in: src/serialization/CborSerializer.ts:28
Decode from binary. manifest is whatever was produced on the other
side (or ” when the serializer does not use one).
Parameters
Section titled “Parameters”Uint8Array
_manifest
Section titled “_manifest”string
Returns
Section titled “Returns”unknown
Implementation of
Section titled “Implementation of”manifest()
Section titled “manifest()”manifest(
_obj):string
Defined in: src/serialization/CborSerializer.ts:22
Return a tag describing the concrete type of obj so the decoder knows
how to reconstruct it. Typical values: class name, event ID, “map”,
“null”, etc. May return an empty string for serializers that don’t
need a manifest.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”toBinary()
Section titled “toBinary()”toBinary(
obj):Uint8Array
Defined in: src/serialization/CborSerializer.ts:24
Encode to binary.
Parameters
Section titled “Parameters”unknown
Returns
Section titled “Returns”Uint8Array