nostr-tools
Advanced tools
Comparing version 1.6.2 to 1.6.3
@@ -436,3 +436,6 @@ "use strict"; | ||
if (!connected()) { | ||
return; | ||
await new Promise((resolve) => setTimeout(resolve, 1e3)); | ||
if (!connected()) { | ||
return; | ||
} | ||
} | ||
@@ -566,4 +569,8 @@ try { | ||
_seenOn = {}; | ||
constructor() { | ||
eoseSubTimeout; | ||
getTimeout; | ||
constructor(options = {}) { | ||
this._conn = {}; | ||
this.eoseSubTimeout = options.eoseSubTimeout || 3400; | ||
this.getTimeout = options.getTimeout || 3400; | ||
} | ||
@@ -605,3 +612,3 @@ close(relays) { | ||
cb(); | ||
}, 3500); | ||
}, this.eoseSubTimeout); | ||
relays.forEach(async (relay) => { | ||
@@ -671,3 +678,3 @@ let r; | ||
resolve(null); | ||
}, 3500); | ||
}, this.getTimeout); | ||
sub.on("event", (event) => { | ||
@@ -674,0 +681,0 @@ resolve(event); |
{ | ||
"name": "nostr-tools", | ||
"version": "1.6.2", | ||
"version": "1.6.3", | ||
"description": "Tools for making a Nostr client.", | ||
@@ -5,0 +5,0 @@ "repository": { |
11
pool.ts
@@ -11,4 +11,9 @@ import {Relay, relayInit} from './relay' | ||
constructor() { | ||
private eoseSubTimeout: number | ||
private getTimeout: number | ||
constructor(options: {eoseSubTimeout?: number; getTimeout?: number} = {}) { | ||
this._conn = {} | ||
this.eoseSubTimeout = options.eoseSubTimeout || 3400 | ||
this.getTimeout = options.getTimeout || 3400 | ||
} | ||
@@ -55,3 +60,3 @@ | ||
for (let cb of eoseListeners.values()) cb() | ||
}, 3500) | ||
}, this.eoseSubTimeout) | ||
@@ -125,3 +130,3 @@ relays.forEach(async relay => { | ||
resolve(null) | ||
}, 3500) | ||
}, this.getTimeout) | ||
sub.on('event', (event: Event) => { | ||
@@ -128,0 +133,0 @@ resolve(event) |
@@ -178,3 +178,6 @@ /* global WebSocket */ | ||
if (!connected()) { | ||
return | ||
await new Promise(resolve => setTimeout(resolve, 1000)) | ||
if (!connected()) { | ||
return | ||
} | ||
} | ||
@@ -181,0 +184,0 @@ try { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2093497
14175