Constructors

  • Parameters

    • multicodec: string
    • getConnections: ((peerId?) => Connection[])
        • (peerId?): Connection[]
        • Return a list of all connections this node has open, optionally filtering by a PeerId

          Parameters

          • Optional peerId: PeerId

          Returns Connection[]

          Example

          for (const connection of libp2p.getConnections()) {
          console.log(peerId, connection.remoteAddr.toString())
          // Logs the PeerId string and the observed remote multiaddr of each Connection
          }
    • addEventListener: (<K>(type, listener, options?) => void)
        • <K>(type, listener, options?): void
        • Type Parameters

          Parameters

          • type: K
          • listener: null | EventHandler<Libp2pEvents<Libp2pServices>[K]>
          • Optional options: boolean | AddEventListenerOptions

          Returns void

    Returns StreamManager

Properties

addEventListener: (<K>(type, listener, options?) => void)

Type declaration

    • <K>(type, listener, options?): void
    • Type Parameters

      Parameters

      • type: K
      • listener: null | EventHandler<Libp2pEvents<Libp2pServices>[K]>
      • Optional options: boolean | AddEventListenerOptions

      Returns void

getConnections: ((peerId?) => Connection[])

Type declaration

    • (peerId?): Connection[]
    • Return a list of all connections this node has open, optionally filtering by a PeerId

      Parameters

      • Optional peerId: PeerId

      Returns Connection[]

      Example

      for (const connection of libp2p.getConnections()) {
      console.log(peerId, connection.remoteAddr.toString())
      // Logs the PeerId string and the observed remote multiaddr of each Connection
      }
log: Logger
multicodec: string
streamPool: Map<string, Promise<void | Stream>>

Methods

Generated using TypeDoc