Libp2p PubSub instance.
Default topic to use when dispatching messages.
Specifies the interval in milliseconds to monitor peers' subscriptions and emit join / leave events. If set to false or <= 0, peers will not be monitored. Defaults to 1000 (1 second).
Readonly
defaultDefault topic to use when dispatching messages.
Protected
Readonly
handlersProtected
Optional
Readonly
monitorProtected
onWraps a MaybePromise-yielding coroutine (generator function) into a function that returns MaybePromise.
This allows you to use maybeAsync
/yield in a similar way to async/await,
where yield maybePromise
will return awaited / resolved value.
Rest
...args: [message: CustomEvent<Message>]const add = maybeAsync(function* (a: number, b: number) {
const result1: number = yield Promise.resolve(a); // result1 === a
const result2 = yield b; // result2 === b
return result + result2;
});
const result = await add(1, 2); // result === 3
Protected
Readonly
pubsubLibp2p PubSub instance.
Protected
Readonly
validatorsReturns if signature is strictly required.
Registers an event handler of a specific event type.
Dispatches a message.
Optional
options: MessageOptionsProtected
onRemoves an event listener.
Subscribes to new messages and returns a handle to unsubscribe.
Optional
options: PeerAwareSubscribeOptions<Uint8Array, PeerId>Returns the list of peers that are subscribed to a topic.
Optional
options: MessageOptionsGenerated using TypeDoc
Libp2p implementation of PeerAwareMessageBus.