An interface representing some way to connect to other peers

Remarks

The Repo uses one or more NetworkAdapters to connect to other peers. Because the network may take some time to be ready the Repo will wait until the adapter emits a ready event before it starts trying to use it

This utility class can be used as a base to build a custom network adapter. It is most useful as a simple way to add the necessary event emitter functionality

Hierarchy (view full)

Constructors

Properties

peerId?: PeerId
peerMetadata?: PeerMetadata
sockets: {
    [peerId: PeerId]: WebSocket;
} = {}

Type declaration

prefixed: string | boolean

Methods

  • Return the listeners registered for a given event.

    Type Parameters

    Parameters

    • event: T

    Returns ((...args) => void)[]

  • Remove all listeners, or those of the specified event.

    Parameters

    • Optional event: keyof NetworkAdapterEvents

    Returns this