mirror of
https://github.com/logos-messaging/docs.waku.org.git
synced 2026-01-02 12:53:12 +00:00
chore: update Filter API (#199)
This commit is contained in:
parent
7ff04b34fb
commit
e46a85aa28
@ -129,7 +129,12 @@ const callback = (wakuMessage) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Create a Filter subscription
|
// Create a Filter subscription
|
||||||
const subscription = await node.filter.createSubscription();
|
const { error, subscription } = await node.filter.createSubscription({ contentTopics: [contentTopic] });
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
// handle errors if happens
|
||||||
|
throw Error(error);
|
||||||
|
}
|
||||||
|
|
||||||
// Subscribe to content topics and process new messages
|
// Subscribe to content topics and process new messages
|
||||||
await subscription.subscribe([decoder], callback);
|
await subscription.subscribe([decoder], callback);
|
||||||
|
|||||||
@ -21,7 +21,12 @@ The `@waku/sdk` package provides a `Filter.ping()` function to ping subscription
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
// Create a Filter subscription
|
// Create a Filter subscription
|
||||||
const subscription = await node.filter.createSubscription();
|
const { error, subscription } = await node.filter.createSubscription({ contentTopics: [contentTopic] });
|
||||||
|
|
||||||
|
if (error) {
|
||||||
|
// handle errors if happens
|
||||||
|
throw Error(error);
|
||||||
|
}
|
||||||
|
|
||||||
// Subscribe to content topics and process new messages
|
// Subscribe to content topics and process new messages
|
||||||
await subscription.subscribe([decoder], callback);
|
await subscription.subscribe([decoder], callback);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user