diff --git a/src/index.ts b/src/index.ts index ebbd6dc..c57624b 100644 --- a/src/index.ts +++ b/src/index.ts @@ -193,7 +193,7 @@ export default class HyperswarmWeb extends EventEmitter { keyPair: this._options.keyPair, }); - this._activeRelay.on("close", () => { + this._activeRelay.dht._protocol._stream.once("close", () => { this._activeRelay = undefined; this._ready = false; });