typescript
class SerializerAbstract serializer class for custom message serialization. Includes terminator sequence to delimit messages in the stream.
IMPORTANT: Must be a named class (not anonymous) for mismatch detection.
Properties
terminator
string | Uint8Array<ArrayBufferLike>
Terminator sequence used to delimit messages in the stream. Must be the same on both client and server.
Methods
deserialize(data: string | Uint8Array<ArrayBufferLike>): TDeserialize string or Uint8Array back to data
Parameters
data:string | Uint8Array<ArrayBufferLike>
Returns
Tserialize(data: T): string | Uint8Array<ArrayBufferLike>Serialize data to string or Uint8Array
Parameters
data:T
Returns
string | Uint8Array<ArrayBufferLike>