Class StreamManager

Hierarchy

  • StreamManager

Constructors

  • Parameters

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

          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
          }

          Parameters

          • Optional peerId: PeerId

          Returns Connection[]

    • addEventListener: (<K>(type: K, listener: null | EventHandler<Libp2pEvents<Libp2pServices>[K]>, options?: boolean | AddEventListenerOptions) => void)
        • <K>(type: K, listener: null | EventHandler<Libp2pEvents<Libp2pServices>[K]>, options?: boolean | AddEventListenerOptions): void
        • Type Parameters

          Parameters

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

          Returns void

    Returns StreamManager

Properties

addEventListener: (<K>(type: K, listener: null | EventHandler<Libp2pEvents<Libp2pServices>[K]>, options?: boolean | AddEventListenerOptions) => void)

Type declaration

    • <K>(type: K, listener: null | EventHandler<Libp2pEvents<Libp2pServices>[K]>, options?: boolean | AddEventListenerOptions): void
    • Type Parameters

      Parameters

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

      Returns void

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

Type declaration

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

      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
      }

      Parameters

      • Optional peerId: PeerId

      Returns Connection[]

log: Debugger
multicodec: string
streamPool: Map<string, Promise<Stream>>

Methods

Generated using TypeDoc