Skip to content

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.

T = unknown

readonly id: 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: boolean

Defined in: src/serialization/Serializer.ts:18

True when this serializer is willing to encode the given value.


readonly name: string

Defined in: src/serialization/Serializer.ts:15

Human-readable name, surfaced in diagnostics.

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).

Uint8Array

string

T


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.

T

string


toBinary(obj): Uint8Array

Defined in: src/serialization/Serializer.ts:29

Encode to binary.

T

Uint8Array