Options
All
  • Public
  • Public/Protected
  • All
Menu

Abstract implementation of Peer. Used as the basis that negotiates protocol versions and requested features.

Hierarchy

Implements

Index

Constructors

constructor

Properties

Protected debug

debug: Debugger

id

id: ArrayBuffer

The unique identifier of this peer.

Protected Readonly transportOptions

transportOptions: TransportOptions

Protected Optional version

version?: number

Accessors

connected

  • get connected(): boolean

latency

  • get latency(): number

onConnect

  • get onConnect(): Subscribable<this, []>

onData

onDisconnect

  • get onDisconnect(): Subscribable<this, []>

Methods

Protected abort

Protected didConnect

  • didConnect(): void

disconnect

  • disconnect(): void

Protected forceConnect

  • forceConnect(id: ArrayBuffer): void

Protected handleDisconnect

  • Handle disconnect event. This implementation will log info about the disconnect and then mark the peer as disconnected.

    Transports may override this to provide reconnection behavior.

    Parameters

    • reason: DisconnectReason
      • the reason why this disconnect happened
    • Optional err: Error
      • optional error recorded

    Returns void

Protected localPublicSecurity

  • localPublicSecurity(): undefined | ArrayBuffer
  • Get a buffer representing a publicly known security challenge for the local side of the peer.

    Returns undefined | ArrayBuffer

    buffer with challenge or undefined

Protected negotiateAsClient

  • negotiateAsClient(): void

Protected negotiateAsServer

  • negotiateAsServer(): void

Protected queueNegotiationTimeout

  • queueNegotiationTimeout(): void

Protected receiveData

  • Receive a message from the peer. This will method is responsible for checking the state of the peer and routing messages to their correct locations.

    Parameters

    • type: PeerMessageType
      • type of message received
    • payload: any
      • data of message received

    Returns void

Protected remotePublicSecurity

  • remotePublicSecurity(): undefined | ArrayBuffer
  • Get a buffer representing a publicly known security challenge for the remote side of the peer.

    Returns undefined | ArrayBuffer

    buffer with challenge or undefined

Protected Abstract requestDisconnect

Abstract send

  • send<T>(type: T, payload: PeerMessage<T>): Promise<void>

Generated using TypeDoc