mirror of https://github.com/waku-org/js-waku.git
Minor fixes
This commit is contained in:
parent
f7613febed
commit
e5dde6f9e9
|
@ -20,7 +20,7 @@ type FilterSubscriptionOpts = {
|
||||||
/**
|
/**
|
||||||
* The Pubsub topic for the subscription
|
* The Pubsub topic for the subscription
|
||||||
*/
|
*/
|
||||||
topic?: string;
|
pubsubTopic?: string;
|
||||||
/**
|
/**
|
||||||
* Optionally specify a PeerId for the subscription. If not included, will use a random peer.
|
* Optionally specify a PeerId for the subscription. If not included, will use a random peer.
|
||||||
*/
|
*/
|
||||||
|
@ -65,7 +65,7 @@ export class WakuFilter {
|
||||||
opts: FilterSubscriptionOpts,
|
opts: FilterSubscriptionOpts,
|
||||||
callback: FilterCallback
|
callback: FilterCallback
|
||||||
): Promise<UnsubscribeFunction> {
|
): Promise<UnsubscribeFunction> {
|
||||||
const topic = opts.topic || DefaultPubSubTopic;
|
const topic = opts.pubsubTopic || DefaultPubSubTopic;
|
||||||
const contentFilters = opts.contentTopics.map((contentTopic) => ({
|
const contentFilters = opts.contentTopics.map((contentTopic) => ({
|
||||||
contentTopic,
|
contentTopic,
|
||||||
}));
|
}));
|
||||||
|
@ -76,13 +76,20 @@ export class WakuFilter {
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
const peer = await this.getPeer();
|
const peer = await this.getPeer(opts.peerId);
|
||||||
const stream = await this.newStream(peer);
|
const stream = await this.newStream(peer);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await pipe([request.encode()], lp.encode(), stream);
|
await pipe([request.encode()], lp.encode(), stream);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
log("Error subscribing", e);
|
log(
|
||||||
|
"Error subscribing to peer ",
|
||||||
|
peer.id.toB58String(),
|
||||||
|
"for content topics",
|
||||||
|
opts.contentTopics,
|
||||||
|
": ",
|
||||||
|
e
|
||||||
|
);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue