Options
All
  • Public
  • Public/Protected
  • All
Menu

Peer that represents a connection between two transport instances. Peers are nodes that the network is directly connected to.

Peers are created by a Transport and provide an abstraction of the location of the remote peer, regardless of it lives on a remote computers, within the same VM or on the same machine.

Hierarchy

  • Peer

Implemented by

Index

Properties

Readonly connected

connected: boolean

If this peer is fully connected.

Readonly id

id: ArrayBuffer

The unique identifier of this peer.

Readonly latency

latency: number

Get the latency of this peer.

Readonly onConnect

onConnect: Subscribable<Peer, []>

Event emitted when this peer connects.

Readonly onData

onData: Subscribable<Peer, [type: PeerMessageType, payload: any]>

Event emitted when a message is received from the peer.

Readonly onDisconnect

onDisconnect: Subscribable<Peer, []>

Event emitted when this peer disconnects.

Methods

disconnect

  • disconnect(): void

send

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

Generated using TypeDoc