Private
activePrivate
Readonly
configPrivate
connectionPrivate
libp2pPrivate
Optional
lightPrivate
peerReadonly
protocolPrivate
createThe pubsub topic to subscribe to.
The subscription object.
Private
getPrivate
getPrivate
setOpens a subscription with the Filter protocol using the provided decoders and callback. This method combines the functionality of creating a subscription and subscribing to it.
A promise that resolves to an object containing:
If there's an unexpected error during the subscription process.
This method attempts to create a subscription using the pubsub topic derived from the provided decoders, then tries to subscribe using the created subscription. The return value should be interpreted as follows:
subscription
is null and error
is non-null, a critical error occurred and the subscription failed completely.subscription
is non-null and error
is null, the subscription was created successfully.
In this case, check the results
field for detailed information about successes and failures during the subscription process.const {subscription, error, results} = await waku.filter.subscribe(decoders, callback);
if (!subscription || error) {
console.error("Failed to create subscription:", error);
}
console.log("Subscription created successfully");
if (results.failures.length > 0) {
console.warn("Some errors occurred during subscription:", results.failures);
}
console.log("Successful subscriptions:", results.successes);
Creates a new subscription to the given pubsub topic. The subscription is made to multiple peers for decentralization.