Interface ValueCodec<T>

it-rpc uses a binary representation of values on the wire. By default it uses CBOR though it is not a requirement.

Custom ValueCodecs can be used to extend the supported value types with application-specific types.

interface ValueCodec<T> {
    type: number;
    canEncode(val): boolean;
    decode(buf, codec, pushable, invocation): T;
    encode?(val, codec, context?, invocation?): Uint8Array;
}

Type Parameters

  • T = any

Properties

Methods

Properties

type: number

A unique number for the value type. It's recommended that user defined types use numbers greater than 1000 to avoid conflicting with built in value transformers

Methods