Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MessageStacksSerializer

Serializer for a batch of message stacks sent by Collabs, represented as an array of (Uint8Array | string)[].

IRuntime implementations may use instance to convert a batch of Collab messages into a single Uint8Array.

As a common-case optimization, this serializer applies suffix compression to message stacks: shared (string) suffixes will only appear once in the serialized message. That helps when stacks contain Collab paths and there are multiple messages from Collabs in similar parts of the Collab tree.

This is a singleton class; use instance instead of the constructor.

Hierarchy

  • MessageStacksSerializer

Implements

Index

Properties

instance: MessageStacksSerializer = ...

Methods

  • deserialize(message: Uint8Array): (string | Uint8Array)[][]
  • Inverse of serialize.

    Typically, this returns a deep clone of the original value, not the same literal reference. Indeed, it is impossible to return the original reference on a different replica.

    Parameters

    • message: Uint8Array

    Returns (string | Uint8Array)[][]

  • serialize(value: (string | Uint8Array)[][]): Uint8Array

Generated using TypeDoc