Serializer
Defined in: src/serialization/Serializer.ts:6
Serializers encode values into bytes for transport between nodes and for persistence. The contract is intentionally small so that custom formats (Protobuf, Avro, msgpack, …) slot in as plug-ins without touching core.
Type Parameters
Section titled “Type Parameters”T = unknown
Properties
Section titled “Properties”
readonlyid:number
Defined in: src/serialization/Serializer.ts:12
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.
includesManifest
Section titled “includesManifest”includesManifest:
boolean
Defined in: src/serialization/Serializer.ts:18
True when this serializer is willing to encode the given value.
readonlyname:string
Defined in: src/serialization/Serializer.ts:15
Human-readable name, surfaced in diagnostics.
Methods
Section titled “Methods”fromBinary()
Section titled “fromBinary()”fromBinary(
bytes,manifest):T
Defined in: src/serialization/Serializer.ts:35
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”T
manifest()
Section titled “manifest()”manifest(
obj):string
Defined in: src/serialization/Serializer.ts:26
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”T
Returns
Section titled “Returns”string
toBinary()
Section titled “toBinary()”toBinary(
obj):Uint8Array
Defined in: src/serialization/Serializer.ts:29
Encode to binary.
Parameters
Section titled “Parameters”T
Returns
Section titled “Returns”Uint8Array