Options
All
  • Public
  • Public/Protected
  • All
Menu

Module ataraxia-transport

Classes and types related to implementing transports.

Index

Type aliases

AuthClientReply

AuthClientReply: { type: Reject } | { data: ArrayBuffer; type: Data }

Reply to send to the server.

AuthServerReply

AuthServerReply: { type: Ok } | { type: Reject } | { data: ArrayBuffer; type: Data }

Reply to send to the client.

PeerMessage

PeerMessage<T>: T extends number ? MessageTypes[T] : never

Type used to resolve what kind of message is associated with an enum value from PeerMessageType. This allows for some extended type safety in peers.

Type parameters

Functions

decodeBinaryPeerMessage

decodeId

  • decodeId(input: string): ArrayBuffer
  • Decode a string into a binary identifier.

    Parameters

    • input: string
      • string to decode

    Returns ArrayBuffer

    decoded string

encodeBinaryPeerMessage

  • encodeBinaryPeerMessage<T>(type: T, data: PeerMessage<T>): ArrayBuffer

encodeId

  • encodeId(id: ArrayBuffer): string

generateId

  • generateId(): ArrayBuffer
  • Generate identifiers that can be used to represent nodes. These are a random UUID, generates 16 bytes of data and sets the markers used for UUID v4.

    Returns ArrayBuffer

    buffer with id

noId

  • noId(): ArrayBuffer

sameId

  • sameId(o1: ArrayBuffer, o2: ArrayBuffer): boolean
  • Check if two identifiers are the same.

    Parameters

    • o1: ArrayBuffer
      • first buffer
    • o2: ArrayBuffer
      • second buffer

    Returns boolean

    true if buffers match

Generated using TypeDoc