Module connection/connection

Index

Type aliases

ConectionStat

ConectionStat: { direction: string; encryption?: string | undefined; multiplexer?: string | undefined; timeline: Timeline }

Type declaration

  • direction: string
    • connection establishment direction ("inbound" or "outbound").
  • Optional encryption?: string | undefined
    • connection encryption method identifier.
  • Optional multiplexer?: string | undefined
    • connection multiplexing identifier.
  • timeline: Timeline
    • connection relevant events timestamp.

ConnectionOptions

ConnectionOptions: { close: () => Promise<void>; getStreams: () => MuxedStream[]; localAddr?: Multiaddr | undefined; localPeer: PeerId; newStream: (protocols: string | string[]) => Promise<{ protocol: string; stream: MuxedStream }>; remoteAddr: Multiaddr; remotePeer: PeerId; stat: ConectionStat }

Type declaration

  • close: () => Promise<void>
    • close raw connection function.
      • (): Promise<void>
      • Returns Promise<void>

  • getStreams: () => MuxedStream[]
    • get streams from muxer function.
  • Optional localAddr?: Multiaddr | undefined
    • local multiaddr of the connection if known.
  • localPeer: PeerId
    • local peer-id.
  • newStream: (protocols: string | string[]) => Promise<{ protocol: string; stream: MuxedStream }>
    • new stream muxer function.
      • (protocols: string | string[]): Promise<{ protocol: string; stream: MuxedStream }>
      • Parameters

        • protocols: string | string[]

        Returns Promise<{ protocol: string; stream: MuxedStream }>

  • remoteAddr: Multiaddr
    • remote multiaddr of the connection.
  • remotePeer: PeerId
    • remote peer-id.
  • stat: ConectionStat
    • metadata of the connection.

MuxedStream

MuxedStream: MuxedStream

Status

Status: "open" | "closing" | "closed"

StreamData

StreamData: { metadata?: any; protocol: string }

Type declaration

  • Optional metadata?: any
    • metadata of the stream
  • protocol: string
    • the protocol used by the stream

Timeline

Timeline: { close?: number | undefined; open: number; upgraded?: number | undefined }

Type declaration

  • Optional close?: number | undefined
  • open: number
    • connection opening timestamp.
  • Optional upgraded?: number | undefined
    • connection upgraded timestamp.