mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2026-02-04 07:44:32 +00:00
ok, we need the prepareSubscription method.
This commit is contained in:
@@ -342,10 +342,7 @@ export class AbstractRelay {
|
|||||||
this.ongoingOperations++
|
this.ongoingOperations++
|
||||||
}
|
}
|
||||||
|
|
||||||
this.serial++
|
const sub = this.prepareSubscription(filters, params)
|
||||||
const id = params.id || (params.label ? params.label + ':' : 'sub:') + this.serial
|
|
||||||
const sub = new Subscription(this, id, filters, params)
|
|
||||||
this.openSubs.set(id, sub)
|
|
||||||
sub.fire()
|
sub.fire()
|
||||||
|
|
||||||
if (params.abort) {
|
if (params.abort) {
|
||||||
@@ -355,6 +352,17 @@ export class AbstractRelay {
|
|||||||
return sub
|
return sub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public prepareSubscription(
|
||||||
|
filters: Filter[],
|
||||||
|
params: Partial<SubscriptionParams> & { label?: string; id?: string },
|
||||||
|
): Subscription {
|
||||||
|
this.serial++
|
||||||
|
const id = params.id || (params.label ? params.label + ':' : 'sub:') + this.serial
|
||||||
|
const sub = new Subscription(this, id, filters, params)
|
||||||
|
this.openSubs.set(id, sub)
|
||||||
|
return sub
|
||||||
|
}
|
||||||
|
|
||||||
public close() {
|
public close() {
|
||||||
this.skipReconnection = true
|
this.skipReconnection = true
|
||||||
if (this.reconnectTimeoutHandle) {
|
if (this.reconnectTimeoutHandle) {
|
||||||
|
|||||||
Reference in New Issue
Block a user