From a7b31294263cb2631824fd3b643e8b9e5e75bac3 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Thu, 31 Aug 2023 18:44:03 -0400 Subject: [PATCH] fix: only set socket if passed --- src/transports/base.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/transports/base.ts b/src/transports/base.ts index c6fe575..1d982e7 100644 --- a/src/transports/base.ts +++ b/src/transports/base.ts @@ -11,7 +11,9 @@ export abstract class BasePeer implements Peer { constructor({ socket, uris = [] }: PeerConstructorOptions) { this.connectionUris = uris.map((uri) => new URL(uri.toString())); this.challenge = new Uint8Array(); - this._socket = socket; + if (socket) { + this._socket = socket; + } } private _id?: NodeId;