Implements the Waku v2 Relay protocol. Throws if libp2p.pubsub does not support Waku Relay

Implements

Constructors

Properties

defaultDecoder: IDecoder<IDecodedMessage>
gossipSub: GossipSub
observers: Map<string, Map<string, Set<unknown>>>

observers called when receiving new message. Observers under key "" are always called.

pubsubTopics: Set<string>
subscribe: (<T>(decoders, callback) => (() => void)) = ...

Type declaration

multicodec: string = ...

Methods

  • Parameters

    • Optional topic: string

    Returns string[]

  • Subscribe to a pubsub topic and start emitting Waku messages to observers.

    Parameters

    • pubsubTopic: string

    Returns void

  • Parameters

    • pubsub: undefined | PubSub<PubSubEvents>

    Returns boolean

  • Type Parameters

    Parameters

    • pubsubTopic: string
    • bytes: Uint8Array

    Returns Promise<void>

  • Mounts the gossipsub protocol onto the libp2p node and subscribes to all the topics.

    Returns Promise<void>

  • Returns void

  • Type Parameters

    Parameters

    Returns (() => void)

      • (): void
      • Returns void

  • Wait for at least one peer with the given protocol to be connected and in the gossipsub mesh for all pubsubTopics.

    Returns Promise<void>