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) {
this._connected = false
this.connectionPromise = undefined