A topology is a network overlay that contains a subset of peers in the complete network.

It is a way to be notified when peers that support a given protocol connect to or disconnect from the current node.

interface Topology {
    filter?: TopologyFilter;
    notifyOnTransient?: boolean;
    onConnect?(peerId, conn): void;
    onDisconnect?(peerId): void;
}

Properties

An optional filter can prevent duplicate topology notifications for the same peer.

notifyOnTransient?: boolean

If true, invoke onConnect for this topology on transient (e.g. short-lived and/or data-limited) connections

Default

false

Methods