Hierarchy

  • Registrar

Properties

getHandler: ((protocol: string) => StreamHandlerRecord)

Type declaration

getProtocols: (() => string[])

Type declaration

    • (): string[]
    • Return the list of protocols with registered handlers

      Returns string[]

getTopologies: ((protocol: string) => Topology[])

Type declaration

    • (protocol: string): Topology[]
    • Return all topology handlers that wish to be informed about peers that support the passed protocol.

      Parameters

      • protocol: string

      Returns Topology[]

handle: ((protocol: string, handler: StreamHandler, options?: StreamHandlerOptions) => Promise<void>)

Type declaration

register: ((protocol: string, topology: Topology) => Promise<string>)

Type declaration

    • (protocol: string, topology: Topology): Promise<string>
    • Register a topology handler for a protocol - the topology will be invoked when peers are discovered on the network that support the passed protocol.

      An id will be returned that can later be used to unregister the topology.

      Parameters

      Returns Promise<string>

unhandle: ((protocol: string) => Promise<void>)

Type declaration

    • (protocol: string): Promise<void>
    • Remove a protocol handler

      Parameters

      • protocol: string

      Returns Promise<void>

unregister: ((id: string) => void)

Type declaration

    • (id: string): void
    • Remove the topology handler with the passed id.

      Parameters

      • id: string

      Returns void