failed to connect to a websocket should reject the promise.

This commit is contained in:
fiatjaf
2025-05-31 11:16:22 -03:00
parent 1437bbdb0f
commit de26ee98c5
3 changed files with 5 additions and 3 deletions

View File

@@ -112,7 +112,9 @@ export class AbstractRelay {
} }
} }
this.ws.onclose = async () => { this.ws.onclose = (ev) => {
clearTimeout(this.connectionTimeoutHandle)
reject((ev as any).message || 'websocket closed')
if (this._connected) { if (this._connected) {
this._connected = false this._connected = false
this.connectionPromise = undefined this.connectionPromise = undefined

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nostr/tools", "name": "@nostr/tools",
"version": "2.13.1", "version": "2.13.2",
"exports": { "exports": {
".": "./index.ts", ".": "./index.ts",
"./core": "./core.ts", "./core": "./core.ts",

View File

@@ -1,7 +1,7 @@
{ {
"type": "module", "type": "module",
"name": "nostr-tools", "name": "nostr-tools",
"version": "2.13.1", "version": "2.13.2",
"description": "Tools for making a Nostr client.", "description": "Tools for making a Nostr client.",
"repository": { "repository": {
"type": "git", "type": "git",