fix: only set socket if passed

This commit is contained in:
Derrick Hammer 2023-08-31 18:44:03 -04:00
parent 4f3af7fdb4
commit a7b3129426
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 1 deletions

View File

@ -11,7 +11,9 @@ export abstract class BasePeer implements Peer {
constructor({ socket, uris = [] }: PeerConstructorOptions) { constructor({ socket, uris = [] }: PeerConstructorOptions) {
this.connectionUris = uris.map((uri) => new URL(uri.toString())); this.connectionUris = uris.map((uri) => new URL(uri.toString()));
this.challenge = new Uint8Array(); this.challenge = new Uint8Array();
this._socket = socket; if (socket) {
this._socket = socket;
}
} }
private _id?: NodeId; private _id?: NodeId;